binmode(STDOUT); use Archive::Zip; use Archive::Zip::Tree; my $zip = Archive::Zip->new(); our $programdir = "."; $programdir = $1 if $0=~/^(.+[\\\/])[^\\\/]+$/; my $docroot = ""; open(CONFIG,"$programdir/getbackup.conf") || &DieConfig; while(<CONFIG>){ $docroot =$1 if /root\=(.+)[\n\r\s]*/i; $backupname =$1 if /name\=(.+)[\n\r\s]*/i; } close(CONFIG); print STDOUT "HTTP/1.0 200 OK\n"; print STDOUT "Content-Type: application/x-downloads\n"; print STDOUT "Content-Disposition: attachment; filename=backup$backupn +ame-".time.".zip\n"; print STDOUT "\n"; # add all readable files and directories below . as xyz/* $zip->addTree( $docroot, './'); # and write them into a file $zip->writeToFileHandle(STDOUT,0); sub DieConfig { print STDOUT "Content-type: text/html\n\n"; print STDOUT "Need getbackup.conf with docroot= and name= setting\ +n"; exit; }
In reply to CGI - Zip tree archiver backup thing by Vennis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |