Zip all .tif, .tiff, or .eps inside a directory and any of it's sub directories. Do not zip any other file types. I did this on a directory with over 160GB of files (varying 5MB to 65MB filesizes) and it ran overnight without a hitch. I'm sure it can be improved, but do not have time to mess with it. I thought it might be helpful to someone out there.
#!C:\Perl\bin\perl.exe -w use File::Find; use Archive::Zip qw( :ERROR_CODES :CONSTANTS); use Cwd; my $dir = cwd(); print "Zipping .tif, .tiff, and .eps files...\n$dir\n\n"; find(\&edits, $dir); sub edits() { my $filename = $_; if (-f and ( /\.tiff?$/ or /\.eps$/ )) { print "$File::Find::name\n"; my $barefile = $filename; substr( $barefile, rindex( $barefile, '.' ) ) = ''; if ($barefile ne '') { my $zip = Archive::Zip->new(); my $member = $zip->addFile($filename); if ($zip->writeToFileNamed("$barefile.zip") == AZ_OK) { unlink($File::Find::name) } else { die 'Error writing file'; } } } }
2005-12-07: Updated regular expression per Celada's input below.

In reply to zip_all for .tif & .eps by buttroast

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.