Hi While I was working on a script that uses rsync file list found this: (which I guess is due adding / for dirs in f_name_cmp) ==2 dirs: # mkdir a a-c # rsync -a . drwxr-xr-x 96 2007/02/04 18:20:35 . drwxr-xr-x 48 2007/02/04 18:20:35 a-c drwxr-xr-x 48 2007/02/04 18:20:35 a ==2 dirs again: #mkdir a a1 # rsync -a . drwxr-xr-x 96 2007/02/04 18:20:11 . drwxr-xr-x 48 2007/02/04 18:20:11 a drwxr-xr-x 48 2007/02/04 18:20:11 a1 ==2 files: # touch a a-c # rsync -a . drwxr-xr-x 96 2007/02/04 18:21:07 . -rw-r--r-- 0 2007/02/04 18:21:07 a -rw-r--r-- 0 2007/02/04 18:21:07 a-c ==2 files again : # touch a a1 # rsync -a . drwxr-xr-x 96 2007/02/04 18:21:07 . -rw-r--r-- 0 2007/02/04 18:21:07 a -rw-r--r-- 0 2007/02/04 18:21:07 a1 shouldnt dir a came before a-c ? catam
On Sun, Feb 04, 2007 at 06:47:57PM +0200, catam wrote:> shouldnt dir a came before a-c ?Directories have an assumed trailing slash on the end of their name for the purposes of sorting, which is why a-c/ comes before a/. The reason for this is that older versions of rsync used to sort files from inside a subdirectory into strange places sometimes (instead of right after the subdir). For instance: a a-c a-c/bar a/foo In a modern rsync, this is now: a-c/ a-c/bar a/ a/foo An alternative solution would have been to sort any '/' char alphabetically prior to all other non-slash characters, but that is not the solution I chose way back when. ..wayne..