Permalink
Switch branches/tags
releng-R2-2.077_006 releng-R2-2.047_004 releng--R2-2.043_001 Marpa-R2-5.043_043 Marpa-R2-4.000000 Marpa-R2-3.001_002 Marpa-R2-3.001_001 Marpa-R2-3.000000 Marpa-R2-2.104000 Marpa-R2-2.102000 Marpa-R2-2.100000 Marpa-R2-2.098000 Marpa-R2-2.096000 Marpa-R2-2.094000 Marpa-R2-2.092000 Marpa-R2-2.090000 Marpa-R2-2.088000 Marpa-R2-2.086000 Marpa-R2-2.084000 Marpa-R2-2.082000 Marpa-R2-2.080000 Marpa-R2-2.078000 Marpa-R2-2.076000 Marpa-R2-2.074000 Marpa-R2-2.072000 Marpa-R2-2.070000 Marpa-R2-2.068000 Marpa-R2-2.066000 Marpa-R2-2.064000 Marpa-R2-2.062000 Marpa-R2-2.060000 Marpa-R2-2.058000 Marpa-R2-2.056000 Marpa-R2-2.054000 Marpa-R2-2.052000 Marpa-R2-2.050000 Marpa-R2-2.048000 Marpa-R2-2.046000 Marpa-R2-2.044000 Marpa-R2-2.042000 Marpa-R2-2.040000 Marpa-R2-2.038000 Marpa-R2-2.036000 Marpa-R2-2.034000 Marpa-R2-2.032000 Marpa-R2-2.030000 Marpa-R2-2.028000 Marpa-R2-2.026000 Marpa-R2-2.024000 Marpa-R2-2.022000 Marpa-R2-2.020000 Marpa-R2-2.018000 Marpa-R2-2.016000 Marpa-R2-2.014000 Marpa-R2-2.012000 Marpa-R2-2.010000 Marpa-R2-2.008000 Marpa-R2-2.006000 Marpa-R2-2.004000 Marpa-R2-2.105_000 Marpa-R2-2.103_010 Marpa-R2-2.103_009 Marpa-R2-2.103_008 Marpa-R2-2.103_007 Marpa-R2-2.103_004 Marpa-R2-2.101_000 Marpa-R2-2.099_000 Marpa-R2-2.097_003 Marpa-R2-2.097_002 Marpa-R2-2.097_001 Marpa-R2-2.095_000 Marpa-R2-2.093_000 Marpa-R2-2.091_001 Marpa-R2-2.091_000 Marpa-R2-2.089_001 Marpa-R2-2.087_002 Marpa-R2-2.087_001 Marpa-R2-2.087_000 Marpa-R2-2.085_008 Marpa-R2-2.085_007 Marpa-R2-2.085_006 Marpa-R2-2.085_005 Marpa-R2-2.085_004 Marpa-R2-2.085_003 Marpa-R2-2.085_002 Marpa-R2-2.085_000 Marpa-R2-2.083_001 Marpa-R2-2.081_001 Marpa-R2-2.079_015 Marpa-R2-2.079_014 Marpa-R2-2.079_013 Marpa-R2-2.079_012 Marpa-R2-2.079_011 Marpa-R2-2.079_010 Marpa-R2-2.079_009 Marpa-R2-2.079_008 Marpa-R2-2.079_007 Marpa-R2-2.079_004 Marpa-R2-2.079_003 Marpa-R2-2.079_002
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (30 sloc) 823 Bytes
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings FATAL => 'all';
use autodie;
use POSIX qw(strftime);
use File::Copy;
use File::Spec;
use English qw( -no_match_vars );
sub usage {
die "Usage: $PROGRAM_NAME from";
}
usage() if scalar @ARGV != 1;
my ($from ) = @ARGV;
die "$from does not exist" if not -e $from;
# Do not worry a lot about portability
my (undef, undef, $filename) = File::Spec->splitpath($from);
my @dotted_pieces = split /[.]/xms, $filename;
my ($base, $extension);
if (@dotted_pieces > 1) {
$base = join '.', @dotted_pieces[0 .. $#dotted_pieces-1];
$extension = '.' . $dotted_pieces[-1];
} else {
$base = $dotted_pieces[0];
$extension = '';
}
my $date = strftime("%d%m%y", localtime);
my $to = join q{}, $base, '-', $date, $extension;
die "$to exists" if -e $to;
copy($from, $to);