how to use SCP if the filename has spaces

Posted on 2006-05-31
Medium Priority
Last Modified: 2013-12-16

On the source computer have a filename like this:

/cygdrive/c/My\ Documents/file.txt

I would like to like to copy this file to another computer.  Here's the command that I tried to use:

scp bryanh@source:/cygdrive/c/My\ Documents/file.txt ./file.txt

However, the computer gives me an errorwhich says something like this:

/cygdrive/c/My: file not found
Documents/file.exe: file not found

Can anyone tell me how to use this command when the filename has a space inside of it?

Question by:bryanlloydharris

Accepted Solution

devrick0 earned 200 total points
ID: 16803044
You should give it a try with quotes, that works for me.

scp user@host:"/cygdrive/c/Documents\ and\ Settings/user/My\ Documents/test\ file.txt" .

Author Comment

ID: 16803073
So you use quotes, but you also use the escape sequences for the spaces?  I will try this.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month14 days, 16 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question