Copy multiple sources to multiple destinations simultaneously
If you want to transfer a selection of files via rsync, i.e. not the entire directory including contents, then the best way of doing so is by using rsync's --files-from
option. Place the pathnames of the files you want to transfer, relative to the source directory you specify. See rsync's manpage for more detailed information.
Related videos on Youtube
Nemoden
Updated on September 18, 2022Comments
-
Nemoden over 1 year
Suppose I need to copy files
~/path/to/file
touser@remote:/path/to/file
~/path/to/another/file
touser@remote:/path/to/another/file
~/path/alternative
touser@remote:/path/alternative
Is there is a way to do this using
rsync
orscp
?I've tried
rsync ~/path/{to/file,to/another/file,alternative} user@remote:/path
But it's not an option if I need to copy to another dest like
another_path
.Copying file-by-file is way too long if I need to copy at least 20 files.
-
wurtel over 9 yearsIf you don't want to transfer the whole contents of
~/path/
then you should look at rsync's--files-from
option. -
Nemoden over 9 years@wurtel, this is actually the best decision addressing the problem so far. If you answer the question, I will accept.
-