in reply to Add timestamp to file being copied.
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Add timestamp to file being copied.
by almut (Canon) on Jun 09, 2009 at 03:08 UTC | |
by Karger78 (Beadle) on Jun 09, 2009 at 13:19 UTC | |
by Karger78 (Beadle) on Jun 09, 2009 at 18:53 UTC |