Alternate node title: "You can't really call this version control"
- Can't afford Perforce?
- Too busy to set up a CVS pserver?
- Too lazy to create an RCS directory?
- No need for branches or tags?
- No desire to share your files?
- Don't really care about commenting on your revision?
If you answered "yes" to the above, then have I got the version control system for you!
It's easy to install and easy to use because it has NO features!
Clearly, this is not meant to be a replacement for your favorite fancy software. I use it when I'm in rapid hack experiment mode and I don't want to clutter up my real version control system with versions that should be thrown away.
It only uses Core modules and works on Unix and Windows. The POD says it all:
=head1 NAME
B<bak> - Make a backup copy of a file
=head1 SYNOPSIS
bak file ...
=head1 DESCRIPTION
A uniquely-named backup copy of a file is created. The file is
written to a subdirectory named C<backup>, which will be created if
it does not yet exist. The name of the backup copy is the original
filename with a date and timestamp appended to it.
Multiple files may also be specified.
Output: A file to subdirectory named C<backup>.
Example1: bak file.txt
Example2: bak *.doc
=cut
use warnings FATAL => 'all';
use strict;
use File::Copy;
use POSIX qw(strftime);
die "Error: No files specified\n" unless @ARGV;
mkdir 'backup';
my $date = strftime('%y%m%d_%H%M%S', localtime);
for my $file (@ARGV) {
copy($file, "backup/${file}_$date") or die "Copy failed: $!";
}
Update: Apr 28, 2011: If you want to preserve file permissions and you have File::Copy version 2.15 or later, change copy to cp.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|