in reply to Re: How to Know how much old my file is
in thread How to Know how much old my file is
is better to use Perl functions when they are! ...Be aware of do not using the module: see Problem with file::stat and Re: File date.
stat is like readdir, its low level, not very memorable, and easy to forget to do your own error checking
Path::Tiny makes life very conveniently memorable and brings in File::stat
$ perl -le " print scalar gmtime( ( stat shift )[9] ) " Thu Jan 1 00:00:00 1970 $ perl -le " print scalar gmtime( ( stat shift )[9] ) " . Tue Sep 15 07:20:27 2015 $ perl -le " print scalar gmtime( ( stat shift )[9] ) " .. Fri May 29 06:13:23 2009 $ perl -le "use Path::Tiny; print scalar gmtime( path( shift )->stat-> +mtime ) " Path::Tiny paths require defined, positive-length parts at -e line 1. $ perl -le "use Path::Tiny; print scalar gmtime( path( shift )->stat-> +mtime ) " . Tue Sep 15 07:20:27 2015 $ perl -le "use Path::Tiny; print scalar gmtime( path( shift )->stat-> +mtime ) " .. Fri May 29 06:13:23 2009
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to Know how much old my file is
by Discipulus (Canon) on Sep 15, 2015 at 07:53 UTC |