Hello,
I'm trying to do a Perl script on Windows (wish it was Unix) that goes to a directory, figures out which files are most recent, within the last week, then copies them to another dir. I'm stuck at the sorting of the files in a directory. This part of the code returns a list but it's not sorted by date:
I'm guessing it's the sort. Would file::stat work better?
Thanks,
TEVO
I'm trying to do a Perl script on Windows (wish it was Unix) that goes to a directory, figures out which files are most recent, within the last week, then copies them to another dir. I'm stuck at the sorting of the files in a directory. This part of the code returns a list but it's not sorted by date:
Code:
opendir(INPUTINFO, ".") or die "Doesn't work: $!";
my @xmlfiles = grep /\.xml$/, readdir INPUTINFO;
my@sorted =
map {join'/',(split/-/)[1,2,0]}
sort
map {join'-',(split'/')[2,0,1]}
qw(12/31/2000 12/26/2000 01/01/2001), @xmlfiles;
print "$_\n" for @xmlfiles;
print "\n";
Thanks,
TEVO
Comment