#!/usr/bin/perl # backup.pl -- backup files listed in `backlist.txt'. #Uses tar -c $addargs -f $filename @files #File Format: #$basedir #$addargs #$file #$files[0] #$files[1] #$files[N] # Dosen't check if the files are present but just spits out # an error message. $debug = 0; #When $debug = 1 then it print debuging info open BACK_LIST, "< backlist.txt" or die "Couldn't open file that lists the items to backup: backlist.txt"; #Test the basedir $basedir = ; chomp $basedir; if ($debug == 1) { print "BaseDIR: $basedir\n"; } unless (-d $basedir) { die "The first line of backlist.txt must be directory." } #Get date and create todays dir @time_date = localtime(); #$day_of_year = time_date(7) if ($debug == 1) { print "$basedir/$time_date[7]\n"; } mkdir "$basedir/$time_date[7]", 0740 or die "Cannot make dir: $basedir/$time_date[7]\n"; } $addargs = ; chomp $addargs; $filename = ; chomp $filename; @files = ; chomp @files; if ($debug == 1) { print "@files\n"; print "tar -c $addargs -f $basedir/$time_date[7]/$filename @files\n"; } system("tar -c $addargs -f $basedir/$time_date[7]/$filename @files"); #>>>>>>>>>>>>>>Close the file<<<<<<<<<<<<< close BACK_LIST;