Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If transfer all files under a directory by rsync, what is the order that rsync determines to transfer the files one by one?

At first it looked like rsync transfers files in alphabetical order, but later I found rsync skipped some files in the first sweep through the alphabetic order, and then went back to transfer files that were skipped in the first time and this time still in alphabetic order.

Thanks and regards!

share|improve this question
up vote 2 down vote accepted

I believe that it transfers the files in the order that they are listed in the directory entry for the directory that they are in. This is generally the order that the files were added to the directory, but if a files is deleted, its spot will be used by the next file added to the directory. You can see this by using ls -f. If you are really interested in the gory details, try man readdir on Linux or man dir on OS X.

share|improve this answer
I don't have a getdents on osx, what does it show? – reconbot Sep 22 '11 at 0:45
@wizard I've updated my answer to point to OS X info as well. – KeithB Sep 22 '11 at 14:57
ls -U (listing files in directory order) can be useful too for watching rsync's progress. – Steve Kehlet Aug 13 '14 at 18:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.