in reply to Add timestamp to file being copied.
It appears from your code that you want to use the time that the script was run as the timestamp on the file, as opposed to the timestamp of the original file you were copying.
If that's the case, may I suggest:
use File::Copy; my ($sec, $min, $hour) = localtime(); foreach my $upload (@uploads) { my $newName = $upload; $newName =~ s/\.zip$/${hour}:${min}:{sec}.zip/; copy ($logSite . ${upload}, $localCpPath . $newName) or die "Failed to copy "$upload"; print "File $upload has been copied over and renamed $newName\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Add timestamp to file being copied.
by Karger78 (Beadle) on Jun 09, 2009 at 14:34 UTC |