I agree that the gnu tools are probably more of a help here than Perl, but I do have some comments on your examples, for the don't really seem to do what the OP asked for (if I understand the post right).

tar -zcvf packagename.tar.gz path_to_directory

This creates a single file, as you state, but the OP is looking for multiple gzip files.

find path1/* path2/* -exec gzip {} \;

This will fail too, for the OP states that there are sub directories ;) This will probably work better:

find path/ -type f -exec gzip {} \;

The problem with this is that a new process will be started for each file (IIRC). Not very efficient if there are a lot of files. So, to change it a little bit more, I would go for the following approach:

find path/ -type f -print0 | xargs -0 gzip

Do note the -print0 and -0. If the files contain spaces, and you leave this out, weird things may happen ;)

HTH

--
b10m

In reply to Re: How to recursively zip all files insied a directory by b10m
in thread How to recursively zip all files insied a directory by Anonymous Monk

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.