Tuesday, December 9, 2008

SCP fail

I was trying to copy a bunch of pdfs from my desktop to a server using scp. This command failed:

/usr/bin/scp user@example.com:~/foo/bar/*.pdf Training/


It returned a error saying "/usr/bin/scp: No match.". This is because the regex wildcard is expanded on the local machine (in this case the server) where the files are not present and therefore not found.

Whereas this one worked.
/usr/bin/scp user@example.com:~/foo/bar/\*.pdf Training/

Notice that the wildcard is now escaped so that it is ignored on the server but will be expanded when scp gets to the remote machine.

9 comments:

patternexon said...

Thanks ! Great tip, Saved from trying to figure this out on my own

Anonymous said...

Thank you! This has been bugging me. Did a web search and found your explanation. Saved me A LOT of trouble.

Anonymous said...

Good looking out. Much appreciated.

Anonymous said...

You saved a day

Derrick Stolee said...

I also found this to be very helpful. I'm glad it is the top hit for 'scp "no match"'

Anonymous said...

Thank you for this!

李奎慶 said...

Thanks!

Daniel Heanes said...

It's rare to look for a straightforward answer and find it straight away. Thank you :-)

Barbie Chiu said...

The strongest and fearless person is the one who knows his/her mistakes and still seek for guidance and forgiveness. Have a pleasant day and keep on smiling. Visit my site for more information.

triciajoy.com

www.triciajoy.com