#!/usr/bin/perl -w

#simple tar archiver... something to make a cron job with
#in the future :)


#thanks for the info for strftime :)  now can parse system time and
#use it
use POSIX qw(strftime);

# still unclear about '-w' verses 'use warnings'
use strict;
use diagnostics;

# where to put the archive::
my $targetpath = "/tmp/databackup";
#for timstamping filename:
my $date = strftime("%A %B %C", localtime time);
# files to archive:
my $files = "/home/willy/tmp";

#parse the date information from strftime-- takes the data and
#removes the spaces
#$date=~ s/^(\S*\s\S*\s\S*).*/$1/s;
#the above is no longer needed- was going to use 'date' untill Robin
#Norwood set me straight :)
#
$date=~ s/\s//g;

#concatonate (thanks to rob and tim)
$targetpath = $targetpath.$date.".bak";

print "path = $targetpath\n"; #debug


#make the archive:
`tar -cvzf $targetpath $files`;


#thank you all :)
#willy


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to