I accidently gzip -rv directory
and now all individual files is in .gz format. How do I undo this and gunzip all .gz files within the directory
?
And how do I just gzip this whole directory?
I tried gunzip directory/*.gz
but only gunzip the files in directory/ it doesn't gunzip directory beyond "directory".
Best Answer
To unzip your files, do the following:
This will unzip all files with the name *.gz
find
can find under the directory/yourdirectory
.For gzipping a whole directory, you need a
tar
container, as gzip can only compress individual files:If you want the (much slower but much more effective) bzip2 compression, use the
j
instead thez
parameter:Both commands will create a compressed archive, there is no need to do an additional compression step afterwards.