gunzip a folder with many files

Try:

find . -type f -exec gunzip {} +

This assumes that current directory only contains files that you want to unzip.


The limit is in the kernel and is on the cumulative size of the arguments and environment passed to the execve() system call used to execute a command. You can split it in several invocations.

To gunzip all the .gz files in the current directory:

with zsh:

autoload zargs # best in ~/.zshrc
zargs ./*.gz -- gunzip

With ksh93:

command -x gunzip ./*.gz

GNUly:

printf '%s\0' *.gz | xargs -r0 gunzip

POSIXly (and with gunzip):

find . ! -name . -prune -name '*.gz' -exec gunzip {} +

(beware that one will also uncompress the hidden .gz files)

Or you can raise that limit on some systems. On recent versions of Linux:

ulimit -s unlimited
gunzip ./*.gz

Simplest way I have found is:

gunzip -r .

Tags:

Shell

Gzip