#!/usr/bin/perl
# Written By Vaibhav Gupta
# vaibhav.gupta@gmail.com
# Modify @FILES_TO_BACKUP @DIRS_TO_BACKUP @FILES_PATH as per your need.
$Directory=`date +%Y%m%d%k%M`;
chomp $Directory; # you know why ?
$HOMEDIRECTORY="~guptav/";
@FILES_TO_BACKUP=(".vimrc",".bashrc","public_html/cgi-bin/index.cgi");
@DIRS_TO_BACKUP=( "cvsroot","public_html/","bin");
@FILES_PATH=("/etc/httpd/conf/httpd.conf");
print "\nCreating directory $Directory\n";
@message = `mkdir $Directory`;
foreach $filename (@FILES_TO_BACKUP) {
@message = `cp $HOMEDIRECTORY$filename $Directory`;
}
foreach $filename (@FILES_PATH) { #Absolute Filename
@message = `cp $filename $Directory`;
}
foreach $dirname (@DIRS_TO_BACKUP) {
@message = `cp -r $HOMEDIRECTORY$dirname $Directory`;
}
@message = `tar -cvzf $Directory.tgz $Directory`;
print @message;
#Vaibhav.