New Tip or Trick - Use the trail above to see more...

  • Spaces in a filename when using the scp command
  • Date submitted: 13/09/2008 by Jim
  • When a filename, or the path to a filename, is being used in the scp command the usual shell escaping mechanism of using a \ does not work.

    To allow paths and/or filenames that have spaces to be used quote the path AND use the \ escaping.

    For example

    This will NOT work:

     

    scp username@server:/directory\ name/with\ a\ filename\ with\ spaces . 

     

    The following WILL work

     

    scp username@server:"/directory\ name/with\ a\ filename\ with\ spaces" .

     

    HTH.

[ back to top ]