good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: find the latest created file in a directoryby sureshepuri (Initiate) |
on Apr 25, 2013 at 06:58 UTC ( [id://1030606]=note: print w/replies, xml ) | Need Help?? |
This can be done through unix command aswell. Not sure whether this suits your requirements
#!/usr/bin/perl
use strict;
use warnings;
my $latest_file=`find . -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "`;
In Section
Seekers of Perl Wisdom
|
|