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
|
|---|
| 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 |