7

I am learning Linux and I was trying the gzip command. I tried it on a folder which has a hierarchy like

Personal/Folder1/file1.amr
Personal/Folder2/file2.amr
Personal/Folder3/file3.amr
Personal/Folder4/file4.amr

I ran "gzip -r Personal" and now its like

Personal/Folder1/file1.amr.gz
Personal/Folder2/file2.amr.gz
Personal/Folder3/file3.amr.gz
Personal/Folder4/file4.amr.gz

How do I go back?

6

You can use

gunzip -r Personal

which works the same as

gzip -d -r Personal

If gzip on your system does not have the -r option (e.g. busybox's gzip) , you can use

find Personal -name "*.gz" -type f -print0 | xargs -0 gunzip
  • I changed my working directory to "Personal" and ran "gunzip -r Personal" and got this result "gzip: Personal.gz: No such file or directory" I do have the -r option because I used it to compress my files – Kazim Jan 21 '15 at 10:45
  • As you used gzip -r Personal to compress it, you can run gunzip -r Personal from the same place to decompress it. If you are inside the Personal directory, you need to run gunzip -r . instead (. is the current working directory). – jofel Jan 21 '15 at 10:50
0

Here is the answer:

Change directories until you're just one step up from the target directory and run this command

gunzip -r Personal
OR
gunzip -r .     <--- if you're in the same directory

. is the current working directory

Thanks @jofel

  • This should be an edit on jofel's answer not a separate answer which adds almost nothing to the existing one... – don_crissti Oct 23 '18 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.