Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: What order do my files come from readdir() in?

by maverick (Curate)
on Jun 19, 2002 at 23:46 UTC ( #175865=note: print w/replies, xml ) Need Help??


in reply to What order do my files come from readdir() in?

IIRC, you're getting them in last modified time order. If you do a stat of each file and print the modification time, they'll appear in order.

Update:Nope, that isn't right. It does have something to do with the inode and how the files are stored on disk, but I can't seem to recall what.

/\/\averick
OmG! They killed tilly! You *bleep*!!

  • Comment on Re: What order do my files come from readdir() in?

Replies are listed 'Best First'.
Re: Re: What order do my files come from readdir() in?
by rob_au (Abbot) on Jun 20, 2002 at 00:14 UTC
    Its the directory order by which they are returned - While this order can change depending upon file systems, this directory order generally relates to the creation order of the file entries in the directory table. The exception to this is where a directory entry is deleted - In this scenario, the directory entry is recycled and any subsequent files stored will preferentially replace the previous directory entry, thus the storage order is no longer wholly 'by creation time'.

     

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://175865]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2017-10-22 07:25 GMTServer Error (Error ID 8359050c38790)

An error has occurred. The site administrators have been notified of the problem and will likely soon fix it. We thank you, for you're patients.

Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (272 votes). Check out past polls.

    Notices?