Skip to content

Using scp on a directory/file with spaces

November 22, 2010

The protocol when copying/moving a file that has spaces in the filename in a terminal window is to use “\ “, or

cp ~/some\ directory/some\ thing.zip ~/destination/

Oddly enough, scp doesn’t employ the same protocol.  Instead, I’ve found that this works:

scp 'myname@location:"~/some directory/some thing.zip" ' ~/destination/

That is, wrap the entire call after scp in single quotes, and the path in double quotes

Or an easy solution: don’t put spaces in filenames or directories

Advertisement
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.