To use scp
or rsync
to copy a file with a colon (:) in its name, you will need to enclose the file name in quotes or use the --
option to indicate the end of options.
Here's an example of how to use scp
to copy a file with a colon in its name:
scp "file:name.txt" user@remote:/destination/
This will copy the file file:name.txt
from the current directory to the /destination/
directory on the remote host.
Alternatively, you can use the --
option to indicate the end of options and avoid the need to enclose the file name in quotes:
scp -- file:name.txt user@remote:/destination/
You can use a similar approach to use rsync
to copy a file with a colon in its name. For example:
rsync -- "file:name.txt" user@remote:/destination/
This will copy the file file:name.txt
from the current directory to the /destination/
directory on the remote host using rsync
.
By enclosing the file name in quotes or using the --
option, you can use scp
or rsync
to copy a file with a colon in its name. It's always a good idea to carefully review the documentation and use the appropriate options when using these commands. This will help ensure that your files are transferred correctly and that any problems are detected and addressed.