Im did see a little error in my code:

return ($a <=> $b);
should be:
return ($ma <=> $mb);


Hermen


At 09:37 19/12/00 -0500, you wrote:
>Thanks Herman, I'll try this code. Now I have started using modification
>time, and dir . /O:D /B to get the files. If I face problem with this then
>I'll have to use timestamp in filename. So I'll test this some time later.
>;)
>
>Thanks again
>Tushar
>
>-----Original Message-----
>From: Hermen Lesscher [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, December 19, 2000 9:24 AM
>To: Kulkarni, Tushar (GEL, MSX)
>Subject: Re: Sorting files on time.
>
>
>I assume you want to sort according filename, and not modification time.
>
>try something like:
>
>opendir(DIR,".") || die "$!\n";
>my @files = grep(! /^\./,readdir(DIR));
>closedir(DIR)
>foreach (sort byfunction @files) {
># process file $_
>}
>
>sub byfunction() {
>     my ($ma,$mb) = ($a,$b);
>     $ma =~ s|.*?_(..)-(..)-(....)_(..)24(..)|$3$2$1$4$5|;
>     $mb =~ s|.*?_(..)-(..)-(....)_(..)24(..)|$3$2$1$4$5|;
>     return ($a <=> $b);
>}
>
>
>Please note: untested code!
>
>I hope this gets you on the way.
>
>Regards, Hermen
>
>
>At 10:32 18/12/00 -0500, you wrote:
> >Hi All,
> >         I have a directory in which I collect all files to process.  I
>have
> >date and time included in my file name(name_MM-DD-YYYY_HH24MI). I want to
> >sort them according to time and then process them(Not necessary to use
> >timestamp in file name). what is the best strategy to do this?
> >         I am on winNT and perl 5.005_02.
> >
> >TIA
> >Tushar
> >_______________________________________________
> >Perl-Win32-Users mailing list
> >[EMAIL PROTECTED]
> >http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

---------------------------------------------------------
Cicero/Galayaa BV                     Home:
Ramen 31A                             Orteliuskade 25-III
1621 EK                               1057 AD
Hoorn NL                              Amsterdam NL
Tel +31-229-245 107                   +31-20-7771911
Fax +31-229-241 961                   +31-6-224 69 136
[EMAIL PROTECTED]                 [EMAIL PROTECTED]
---------------------------------------------------------

_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to