Looking for a quick script solution

Richard Pieri richard.pieri-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org
Thu Jun 25 22:33:54 EDT 2009


On Jul 25, 2009, at 8:29 PM, sgoldman wrote:
>        If there was ever a need for a script this is it.. little  
> experience here though..


No script needed.  Just:

   gunzip *.gz

If that throws a too many files error then you should use a find  
command:

   find . -depth 1 -name "*.gz" -print | xargs gunzip

This finds all files in the current directory (.) but no deeper than  
the current directory (-depth 1) that match "*.gz" and execs gunzip on  
each one.  It is slower than a single shell glob.  Much slower.  It  
has to open and stat the directories and then exec gunzip for every  
file.  On the other hand, it works even when you have so many files  
that you can't use a shell glob.

--Rich P.





More information about the Discuss mailing list