or, TIMTOWTDI...
#!/usr/bin/perl use warnings; use strict; #769688 my ($sec, $min, $hr); # easier on your fingers; fewer "my"s.. +. ($sec,$min,$hr) = localtime(time); if ( $sec =~ /(\d{1})/ ) { # deal with times ending w/0..9 seconds $sec = "0" . $1; } my $file = 'filename.zip'; #if you need to act upon a list of files +, loop my @filenamearray = split(/\./, $file); my $newfilename = "$filenamearray[0]" . "-" . $hr . ":" . $min . ":" . + $sec . "\." . $filenamearray[1]; print $newfilename . "\n"; #now upload $newfilename...
Output of repeated execution appears to meet your spec.
filename-19:50:00.zip filename-19:50:04.zip filename-19:50:07.zip filename-19:50:09.zip filename-19:50:10.zip filename-19:50:11.zip
In reply to Re: Add timestamp to file being copied.
by ww
in thread Add timestamp to file being copied.
by Karger78
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |