Re: How can I sort files by timestamp without slurping?
- From: martin@xxxxxxxxxx (Martin Barth)
- Date: Thu, 29 Nov 2007 11:26:01 +0100
Hi,
I'm thinking on incorporating a timestamp sorting mechanism without
slurping.
You wouldn't slurp anything. You would just assign the _names_ of the
files to an array. Why would that be so bad?
If you have that much files that you do not want to put all names in an
array you could do following: (pseudocode)
1. open your directory
2. my $mtime_var, $filename;
2. read one/next file.
3. get mtime of file
4. if($mtime_var == 0) { $mtime_var = mtime of file }
5. if($mtime_var > mtime of file) { $mtime_var = mtime_of file; $filename =
name of file }
6. goto 2.
note: do not store your file in an array if you do the sorting that way.
you 'll end with an array with all files in it; so you will not save any
memory!!
HTH Martin
.
- References:
- How can I sort files by timestamp without slurping?
- From: Icarus
- Re: How can I sort files by timestamp without slurping?
- From: Gunnar Hjalmarsson
- How can I sort files by timestamp without slurping?
- Prev by Date: Re: How can I sort files by timestamp without slurping?
- Next by Date: Re: How can I sort files by timestamp without slurping?
- Previous by thread: Re: How can I sort files by timestamp without slurping?
- Next by thread: Re: How can I sort files by timestamp without slurping?
- Index(es):
Relevant Pages
|
|