Copying files with colons using scp or rsync
Seems that there's a lot of people out there that do not know how to copy a file with a colon in it's name (for example a:a.txt) using scp or rsync, so here's an explanation:
The trick is to know where you're using the : character. If it's a remote file there's no problem and no need of escaping since you preceded already by an :. Example:
scp me@my.machine.com:a:a.txt .
If it's a local file you just have to say it explicitly by expressing a path. Example:
scp ./a:a.txt me@my.machine.com:
This works for me at least on OpenSSH 4.3.
mv a:a.txt a_a.txt
ReplyDeletescp a_a.txt me@my.machine.com:
ssh me@my.machine.com mv a_a.txt a:a.txt
ehehehheeh... pronto, pronto... :-D
While being a bigger line is fine for me, having to insert my password twice isn't really that fun :-P
ReplyDelete