view scripts/youngest @ 104:76ad709ed3c6

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 06 Oct 2014 05:04:24 +0300
parents 7deced264648
children
line wrap: on
line source

#!/usr/bin/perl -w
#
#	youngest - print the date (yyyy-mm-dd) of the last modified file
#	Usage : youngest <file> ...
#
use strict;

my $mtime_max = 0;
foreach my $fic (@ARGV)
{
   my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,
       $atime, $mtime, $ctime, $blksize, $blocks) = stat($fic);
   my $loc_ti = localtime($mtime);
   $mtime_max = $mtime if ($mtime_max < $mtime);
}
my ($ss, $mi, $hh, $jj, $mm, $aa) = localtime($mtime_max);
printf "%04d-%02d-%02d", $aa + 1900, $mm + 1, $jj;