#!/usr/bin/perl -w ######################################### # Local UnZip Utility 2010 expandinghead.net # The .zip or .gz file you wish to open must be in # the directory this script is installed in. This script # will unzip and add the file(s) to the directory. # Be careful, as it will over-write any existing file(s) # which share the same name. # Requires the module CGI.pm. # Chmod this script to 755 #################################### # This software is provided "as is" and any express or # implied warranties, including, but not limited to, the implied warranties # of merchantability and fitness for a particular purpose are disclaimed. # In no event shall the author be liable for any direct, indirect, # incidental, special, exemplary, or consequential damages #################################### my ($file, $Result); use CGI qw(:standard); use strict; print header,start_html(-title =>'Local UnZip Utility', -author =>'expandinghead.net', -bgcolor => '#ffffff', -text => '#000000'), p,h1('Local UnZip Utility'),p,'enter the zipped file extension',hr, start_form,table(Tr([ td(['File Name ',textfield(-size=>50,-name=>'file')]), td([submit(undef,' Submit '),reset]), ])),end_form; if (param()) { $file = param('file'); if ( ! -e $file ) { print p,h4("Error : $file cannot be found"),p,em,'End of Action'; } else { if ($file =~ /\.zip$/i) { $Result = `unzip $file; ls $file 2>&1`; print p,$Result,p,em,"End of Action"; } elsif ($file =~ /\.gz$/i) { $Result = `gzip -l $file; gzip -d $file`; print p.pre($Result).p.em,"End of Action"; } else { print p,h4('The file must end with .zip or .gz'),p, 'You entered : ',em,$file,p,em,'End of Action'; } } } print p,h5('expanding head'),end_html;