Robert Eduard Antal
Robert Eduard Antal

Reputation: 43

Launch multiple simultaneous rsync processes to copy one file in every sub-directory (maxdepth -1)

I would like to transform a plain rsync command, which copies one file (robots.txt) to the target sub-folders situated at 1 level depth (maxdepth -1) into a multi-threaded command, using parallel, or any other solution which speeds up transfer :

Plain rsync:

find /home/targetfolders* -maxdepth 1 -type d  -exec rsync -av /home/source/utils/robots.txt {} \;

What would be the best solution ?

Upvotes: 1

Views: 8293

Answers (1)

Mark Setchell
Mark Setchell

Reputation: 207415

Not sure I think this is a good idea, but if you want to do it with GNU Parallel, you would be looking at something like this:

find /home/targetfolders* -maxdepth 1 -type d -print0 | 
  parallel -j 16 -0 rsync -av /home/source/utils/robots.txt {}

Upvotes: 1

Related Questions