in reply to Re: How to recursively zip all files insied a directory
in thread How to recursively zip all files insied a directory

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

Replies are listed 'Best First'.
Re: Re: How to recursively zip all files insied a directory
by Roger (Parson) on Jan 15, 2004 at 12:30 UTC
    tar -zcvf packagename.tar.gz path_to_directory

    I thought that was a good way to zip up directories and files recursively. Just to offer an alternative on the off chance that OP is looking for a way to save some space. Zipping everything into a single tar file will certainly save a lot more disk space than zipping them individually.

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

    That's a good catch. I forgot about find will return directory names too.