--list-only ordering

Chris Dennis cgdennis at btinternet.com
Mon Dec 17 10:23:12 MST 2012


On 17/12/12 17:09, Paul Slootman wrote:
> On Mon 17 Dec 2012, Chris Dennis wrote:
>>
>> I've noticed an apparent inconsistency in the ordering of output
>> from the --list-only option.
>>
>> For example:
>>    $ ls
>>    d1  d2  d2-x  d3  f1  f2  f2-x  f3
>>    $ rsync --list-only .
>>    drwxr-xr-x        4096 2012/12/17 15:18:05 .
>>    -rw-r--r--           0 2012/12/17 15:17:52 f1
>>    -rw-r--r--           0 2012/12/17 15:17:52 f2
>>    -rw-r--r--           0 2012/12/17 15:17:52 f2-x
>>    -rw-r--r--           0 2012/12/17 15:17:52 f3
>>    drwxr-xr-x        4096 2012/12/17 15:17:40 d1
>>    drwxr-xr-x        4096 2012/12/17 15:17:40 d2-x
>>    drwxr-xr-x        4096 2012/12/17 15:17:40 d2
>>    drwxr-xr-x        4096 2012/12/17 15:17:40 d3
>>
>> Note that the files are listed in a 'sensible' order, with f2-x
>> coming after f2.  But for the directories, d2-x comes before d2.
>
> I wouldn't be surprised if rsync appends a slash to the directory names
> internally; '-' sorts before '/' in ASCII.

That would explain it.  I just hope that the behaviour doesn't change.

Thanks for your help.

Chris
-- 
Chris Dennis                                  cgdennis at btinternet.com
Fordingbridge, Hampshire, UK


More information about the rsync mailing list