Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: files out of order

From: bobr:dprc at: 30-Mar-2001 0:01

something to point out is that the files might not be in the directory in name order to begin with. rebol is just returning the order the OS returns them in. many systems (unix in particular) recycle directory entries so when you (or rebol executive) uses the "opendir/readdir()" functions the order you get them back in is a not-guaranteed-to-be-alphabetical ordering. if nothing has done any renaming or deleting then this has a /chance/ of being in creation order. on linux, try "ls -U" to see this. I see the solutions being offered go right for a sort so you are on the right track. At 01:33 PM 3/29/01 -0600, [ryan--christiansen--intellisol--com] wrote:
>I have a directory of XML-formatted messages, each saved with a numeric >filename based on the time of creation, for example > >/news/20010329105032.txt >/news/20010329105033.txt >/news/20010329105034.txt > >I use the following function to read the directory and to create a block of >file names, with the intention of placing the newest files first in the >block (in other words, the files with the highest number first in the >block.) > >read-directory-messages: func [ > "Read a directory of XML-formatted standard messages with the directory >determined by messageType." > message-directory [block!] "A block of file names corresponding to a >directory of XML-formatted standard messages." >][ > message-block: copy [] > foreach file-name message-directory [ > file-contents: read file-name > insert message-block file-contents > ] >] > >But using the above function, I get files showing up in the block out of >order. Am I doing something wrong? > >Ryan C. Christiansen >Web Developer > >Intellisol International >4733 Amber Valley Parkway >Fargo, ND 58104 >701-235-3390 ext. 6671 >FAX: 701-235-9940 >http://www.intellisol.com > >Global Leader in People Performance Software > >_____________________________________ > >Confidentiality Notice >This message may contain privileged and confidential information. If you >think, for any reason, that this message may have been addressed to you in >error, you must not disseminate, copy or take any action in reliance on it, >and we would ask you to notify us immediately by return email to >[ryan--christiansen--intellisol--com] > >-- >To unsubscribe from this list, please send an email to >[rebol-request--rebol--com] with "unsubscribe" in the >subject, without the quotes.
;# mailto: [bobr--dprc--net]