Brian -
And on Sat, Sep 25, 1999 at 11:54:40AM +0930 it was said by Brian Salter-Duke:

| This does exactly what you asked for and is much shorter than the one I
| posted a while back.
| 
| #!/usr/local/bin/perl
| $file = $ARGV[0];
| $base = $file;
| $base =~ s?\.gz??;
| print "Type the directory name where you wish to save the file: ";
| $dir = <STDIN>;
| chop($dir);
| system "/usr/local/bin/gunzip $file";
| system "cp $base $dir";
| unlink $base;
| 
| Cheers, Brian. 

Have finally looked at this (when a whole lot of zipped files came in by
mail) and adjusted the script a bit as you may see below - I left the
comments in just for show.  The script does what I want, but will have to
add stuff to handle tar.gz files as well.  Also wanted to add some user
feedback of the system command - but failed - did not try too hard  (last two lines).  

A real bonus is that your system "command" allows interpretation of my env
variables like $re = /usr/data/development/reports etc.  But an unpatched
mutt don't - major :( -
(Would be great to have tab completion and other readline type
functionality, I guess.)

Thanks for your help:


#!/usr/local/bin/perl
#$file = $ARGV[0];
#$base = $file;
#$base =~ s?\.gz??;
#$base =~ s?\.zip??;
#My gunzip did not seem to have an option for destination dir.
print "Type the directory name where you wish to save the file: ";
$dir = <STDIN>;
chop($dir);
system "/usr/bin/unzip -d$dir $ARGV[0]";

#print "$!";
#print "Click anything to carry on";
#(<>);
#system "cp $base $dir";

-- 
Eric Smith
[EMAIL PROTECTED]

Pass calmly through the clamour of the bungled.

Reply via email to