How to scp a file name with a colon

Lets say you have a lot of files e.g. named something like duplicity-full.2008-01-09T17:51:27+02:00.vol100.difftar.gpg

Simply running scp * user@host.com: will give an error like: ssh: duplicity-full.2008-01-09T17: Name or service not known because scp thinks the file name is a host name (because of the colon).

The fix is simple: Add a ./ in front of the * or filename, e.g. scp ./* user@host.com:. Then scp will see the ./ before the colon, and know it’s a file. That trick also helps if you have a file named - (yes, dash) or which starts with a dash (some programs don’t like that).

Comments are closed.