To copy a file that has a colon (:) in its name using scp
or rsync
, you need to escape the colon with a backslash (\
).
For example, if you want to copy a file named file:1
from a remote host example.com
to the current directory on your local machine, you would run:
scp user@example.com:file\:1 .
Similarly, if you want to use rsync
to copy the file, you would run:
rsync -avz user@example.com:file\:1 .
Note that the backslash before the colon must be included within single quotes ('
) or double quotes ("
) to prevent the shell from interpreting it.