Search code examples
rsync

rsync read from multiple list of files


To copy from a list, I can this

rsync -av --files-from=/pathtofolder/file1.txt rootdir destdir

but what if I have multiples list of files (file1.txt, file2.txt, etc) that has to be rsync'ed. For example none of the wildcard work

rsync -av --files-from=/pathtofolder/*.txt rootdir destdir
rsync -av --files-from=/pathtofolder/* rootdir destdir

this one works but I have to write every file name

rsync -av --files-from=/pathtofolder/{file1.txt,file2.txt,file3.txt} rooter destdir

How to do this?


Solution

  • You might try to create virtual file with concatenation of all the files you want to rsync:

    rsync -av --files-from=<(cat /pathtofolder/*.txt) rootdir destdir