Unzipping all .gz files in all subdirectories
I was trying to make a backup of my system last night and I screwed up the gzip command and ended up compressing over half the files in my system. :rolleyes: I was able to 'gunzip *.gz' to my /bin and most of my /etc so I can boot but there are still a lot of .gz files in /usr and others. Is there a way to go through all subdirectories and gunzip all files ended in .gz? Or maybe even exclude all the one's with .tar.gz?
Thanks, |
Code:
find -name '*.gz' | grep -v tar.gz | xargs -n1 echo gunzip |
Ok, I tried that but it would only list the files in my current directory so I made the slight change to "find / -name '*.gz' | grep -v tar.gz | xargs -n1 echo gunzip" The command then will list all the files so I took out the echo before gunzip and it will list the .gz file followed by "is not a directory or a regular file - ignored" How do I get it to unzip those files?
|
Have you spaces in the files or directories?
If so, Code:
find / -name '*.gz' -print0 | grep -Zzv tar.gz | xargs -0 -n1 echo gunzip |
Does running one gunzip command manually work?
|
maybe write a little script, I've read gunzip doesn't take well to pipeing make sure to log in as su so no permission denied files come up.
for FILENAME in `find -name *tar.gz -print` do gunzip $FILENAME done |
Sorry it took me so long to reply, to ToniT: There aren't spaces and I get the same error with the new command and yes one gunzip command manually works. To slick_willie: Putting in a script simply printed out the gunzip command useage.
Thanks for all the help so far |
The command with those grep -Zz stuff works fine for me. Strange.
|
I checked and the only files I have left that are .gz are in /usr/share/man, do these files need to be decompressed?
|
They are compressed in my system (debian) and I think the man can uncompress them on the fly when needed.
|
Maybe that's why it ignored some of the files. I got the system working, thanks for the help
|
All times are GMT -5. The time now is 03:50 AM. |