On Fri, Sep 24, 1999 at 04:47:00PM +0200, Eric Smith wrote:
> Maybe this is not really a mutt question.
>
> I have the following line(s) in my .mailcap which is most useful:
>
> application/zip; /usr/bin/unzip -d/var/tmp/unzipped/ %s
> application/x-zip-compressed; /usr/bin/unzip -d/var/tmp/unzipped/ %s
>
> As you see, it unzips a zip attachment automatically when I press on it, now
> is it possible to have the routine prompt me for what destination dir I wish to
>unzip to?
>
I thought I would modify one of my files to do something similar. This
does not prompt for the directory but for the full file name. A default
directory is set in $WORK. It would be easy to change to have the prompt for
the directory. I call it save_gz. Note it uses gunzip not unzip. You
could replace gunzip with 'gzip -d'.
#!/usr/local/bin/perl
# You will have to change the variable below.
# Where you want to put the output file.
$WORK = "/u/b_duke";
$file = $ARGV[0];
$unzip = $file;
$unzip =~ s?\.gz??;
$base = $unzip;
$unzip =~ s?^.*/?$WORK/?;
confirm:
print "The output file will be saved as: $unzip\n";
print "Do you want to change the name? ([n]y) ";
$char = <STDIN>;
chop($char);
if ( $char eq "y" ) {
print "Type in new name: ";
$unzip = <STDIN>;
chop($unzip);
goto confirm;
}
# end of confirm loop.
system "/usr/local/bin/gunzip $file";
system "cp $base $unzip";
unlink $base;
I hope this is useful.
Cheers, Brian.
--
Associate Professor Brian Salter-Duke (Brian Duke)
Chemistry, Faculty of Science, IT and Education, Northern Territory University,
Darwin, NT 0909, Australia. Phone 08-89466702. Fax 08-89466847
[EMAIL PROTECTED] http://www.smps.ntu.edu.au/school/compchem.html