I have such directories structure on server 1:
An alternative to Andron's Answer which is simpler to both understand and implement in many cases is to use the --files-from=FILE
option. For the current problem,
rsync -arv --files-from='list.txt' old_path/data new_path/data
Where list.txt
is simply
company1/unique_folder1/
company2/unique_folder1/
...
Note the -r
flag must be included explicitly since --files-from
turns off this behaviour of the -a
flag. It also seems to me that the path construction is different from other rsync commands, in that company1/unique_folder1/
matches but /data/company1/unique_folder1/
does not.