Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force rsync to transfer files in the order listed in the from-file param

Tags:

cygwin

rsync

Say you have a list of files in filelist.txt and call rynsc like so:

$rsync --files-from=filelist.txt /path/to/source /path/to/destination

Rsync sorts the files in filelist.txt before processing them. According to the man page, this is to make the transfer more efficient.

How do I turn that off? I have a case where I want the files transferred in a very specific order and I don't care if it makes the transfer less efficient.

like image 504
Sukotto Avatar asked Sep 24 '12 20:09

Sukotto


1 Answers

cat filelist.txt | xargs -n1 -I{} rsync --progress "/path-from/{}" "/path-to/{}"

This should pass each file to rsync via xargs one line at a time.

You can replace

cat xxx.txt

with

ls -t | xargs ....

if you prefer.

Indeed rsync annoyingly doesn't use the order that you specified in the list.

like image 82
BadBiki Avatar answered Oct 03 '22 01:10

BadBiki