This is for a windows based machine.
I need it to find the newest created file in a folder than set it as a variable so i can use it in my script.
I tried this:use File:irList; my @list = File:irList::list(‘.’, ‘M’);
from this:
print "hello worldn"; print $list[1]; ? is giving me this:
|
I tried this but i dont think its showing the newest one.
$dirname = ".";
opendir(DIR, $dirname) or die $!;
@files = sort { -m "$dirname/$a" <=> -M "$dirname/$b"}
grep {-f "$dirname/$_"}
readdir(DIR);
print $files[0];
I also reversed the a and b and it still shows the same file name? Possibly this script isnt taking account of time?