To use rsync
to copy files and directories with whitespace or blank characters in their names, you will need to enclose the names in quotes or use the --
option to indicate the end of options.
Here's an example of how to use rsync
to copy a file with a whitespace character in its name:
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.
Alternatively, you can use the --
option to indicate the end of options and avoid the need to enclose the file name in quotes:
rsync -- file\ name.txt user@remote:/destination/
You can use a similar approach to use rsync
to copy a directory with a whitespace character in its name. For example:
rsync -- "directory name/" user@remote:/destination/
This will copy the directory directory name/
from the current directory to the /destination/
directory on the remote host using rsync
.
By enclosing the names in quotes or using the --
option, you can use rsync
to copy files and directories with whitespace or blank characters in their names. It's always a good idea to carefully review the documentation and use the appropriate options when using rsync
. This will help ensure that your files are transferred correctly and that any problems are detected and addressed.