CUFP
toolic
Alternate node title: "You can't really call this version control"
<p>
<ul>
<li>Can't afford Perforce?
<li>Too busy to set up a CVS pserver?
<li>Too lazy to create an RCS directory?
<li>No need for branches or tags?
<li>No desire to share your files?
<li>Don't really care about commenting on your revision?
</ul>
<p>If you answered "yes" to the above, then have I got the version control system for you!
<p>It's easy to install and easy to use because it has NO features!
<p>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.
<p>It only uses Core modules and works on Unix and Windows. The POD says it all:
<c>
=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: $!";
}
</c>
<p>Update: Apr 28, 2011: If you want to preserve file permissions and you have [doc://File::Copy] version 2.15 or later, change <c>copy</c> to <c>cp</c>.