in reply to Moving log files, create folder based on local time/date & zip them up based on local time & date.

I'm not in a windows environment right now, so I can't test whether stat works with UNC specifications, but with a bit of luck the following will let you test for files that are older than seven days (otherwise there's undoubtably a Win32 module that does it for you):

my $age = (stat $remote)[9]; my $cutoff = time - 86400 * 7; # now less 7 days if( $age < $cutoff ) { # file is older }

A more compact way of creating the filename (and this is the third time in a week I think I've suggested this) you can do the following:

my $dirname = sub { sprintf '%02d%02d%02d%02d%02d%02d', $_[0] % 100, @_[1..5] }->((localtime)[5,4,3,2,1,0]);

It may look complicated, but it saves on all those pesky intermediate variables.


print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'
  • Comment on Re: Moving log files, create folder based on local time/date & zip them up based on local time & date.
  • Select or Download Code