Re: basic find sorting behavior



Jeff wrote:
This is a very basic question about find. I have 4 directories (a, b ,c, d)
without files under. When I issue "find . -type d", the output is "c, a, b,
d". I would like to understand why it is sorted this way considering that
the directories were created the same day with the following time:

mtime ctime atime
./c 8:17:55 8:17:55 8:43:35
./a 8:17:50 8:17:50 8:43:35
./b 8:17:53 8:17:53 8:43:35
./d 8:43:34 8:43:34 8:43:35

Thanks
jeff

find uses the getdents() system call to read the directory.

man getdents

The order given by getdents() depends on the file system.
It can be in the order the files are created,
or it can be a quasi-random order (due to some hash algorithm).

--
Michael Tosch @ hp : com
.



Relevant Pages

  • Re: Hijacked - Search Extender, Shopping Wizard, Home Search Assis
    ... but removing completely would require access to the file system, ... not through Windpws Explorer or My Computer then at least through a ... DOS prompt. ... Jeff ...
    (microsoft.public.security)
  • Re: [patch/rft] jbd2: tag journal writes as metadata I/O
    ... I wrote a small fio script which is doing buffered writes with bs=32K and I ... impose on other workloads sharing the file system dominates the ... Jeff, any thoughts or comments? ...
    (Linux-Kernel)
  • Re: Disk write cache
    ... Jeff> There is a large amount of yammering and speculation in this thread. ... Jeff> Most disks do seem to obey SYNC CACHE / FLUSH CACHE. ... >> on both SCSI and ATA, ALL the file system does not pass the test. ... Jeff> It sounds like your test (or reasoning) is invalid. ...
    (Linux-Kernel)
  • Re: Replacing files on a IIS Web Server
    ... >I simply try to copy the file on the file system, ... >locked by web users. ... It has a retry you can set if ... Jeff ...
    (microsoft.public.inetserver.misc)