Decompress directory using Gzip


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Decompress directory using Gzip
# 1  
Old 03-05-2008
Decompress directory using Gzip

Hey there...

Just has a query.

I have been trying to zip and unzip a directory.
I used gzip -c -r <directory> to recursively search the directory and zip it
Now is want to unzip the directory, by
gunzip -r <filename>.gz

The problem is that the unzip creates on file with the contents of all the files in it. No the entire directory with sub-directories and files

Any suggestions are welcome.

I do not want to tar and gzip... only gzip
# 2  
Old 03-05-2008
gzip is designed to compress files. The "problem" here is that everything on a unix filesystem is a "file" including a directory. the content of a "directory file" are the underlying files. That is what you see.

therefor you need "tar" or "cpio" or whatever you like to create one "file" that is compressed later.
There is no need to worry about tar and friends. you can use tar -xzf <file> to extract and tar -czf <file> <dir> to create without seeing gzip at all. tar offers a pletora of other options also.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Multiple .gz decompress files and dump other directory

I have code below for i in *.gz; do gzip -dc $i /home/vizion/Desktop/gzipfile/; done one more for i in *.gz; do gunzip -dc $i /home/vizion/Desktop/gzipfile/; done both are getting error: "gunzip: /home/vizion/Desktop/gzipfile/ is a directory -- ignored " i have requirement below in... (3 Replies)
Discussion started by: Chenchireddy
3 Replies

2. UNIX for Dummies Questions & Answers

help creating gzip of directory files via cron

**BTW- very new to scripting** I have created a shell script to gzip the public_html files on our website. I have tested this script on another directory on our site and it worked, but when I replaced the directory with the public_html directory it failed. I am executing this script via a... (7 Replies)
Discussion started by: alblue
7 Replies

3. UNIX for Advanced & Expert Users

gzip vs pipe gzip: produce different file size

Hi All, I have a random test file: test.txt, size: 146 $ ll test.txt $ 146 test.txt Take 1: $ cat test.txt | gzip > test.txt.gz $ ll test.txt.gz $ 124 test.txt.gz Take 2: $ gzip test.txt $ ll test.txt.gz $ 133 test.txt.gz As you can see, gzipping a file and piping into gzip... (1 Reply)
Discussion started by: hanfresco
1 Replies

4. Shell Programming and Scripting

How to retain "directory" timestamp when using gzip?

Hello All, I am trying to gzip a directory contents with the option "-r". The file timestamps remaining same but not the directory, how to retain it too. ex: $ ls -l 20090624065000 total 1213360 -rwxrwxrwx 1 cisa users 529513119 Jun 24 2009 A -rwxrwxrwx 1 cisa ... (2 Replies)
Discussion started by: panyam
2 Replies

5. Shell Programming and Scripting

gzip files inside directory

Hello folks I hope every one is fine. I need to ask one question. I have directory /xx/abcd/data/ inside that data there are files like 11.txt 23.txt 12.txt *.txt i want that i will do compress each txt file inside that directory /xx/abcd/data/. But it will not gzip data... (1 Reply)
Discussion started by: learnbash
1 Replies

6. Shell Programming and Scripting

Bash: Gzip files in Directory and itīs Subdirectories

Hello dear Community, I have a task to wrtie a script which will gzip not zipped files in a directory and itīs subdirectories. I succeeded in gzippung the directory but not the subdirectories: #/bin/bash #go to the directory where to zip cd $1 #Zip unzipped files for i in `ls | xargs... (2 Replies)
Discussion started by: JamesCarter
2 Replies

7. Shell Programming and Scripting

gzip a directory (URGENT)

Hi I have one directory as "eAMRLTXFLDS0"...I am supposed to create a eAMRLTXFLDS0.ofcld.gz using gzip... Can u plz help me wth the command.. Thanks in advance.. (4 Replies)
Discussion started by: grajesh_955
4 Replies

8. UNIX for Dummies Questions & Answers

gzip all the files in a directory

Hi, There are multiple files in a directory with different names.How can they be gzipped such that the timestamp of the files is not changed. (2 Replies)
Discussion started by: er_ashu
2 Replies

9. UNIX for Dummies Questions & Answers

Decompress a .SP file

Hi to all, I'm new in this forum and I just need a quick answer from the experts out there, I have a 2761.sp file, in short a ".SP" file, it was given to me compressed, and I need to decompress it before Monday. I saw a software named Splint, but it shows an error, a DMI error message, so I dont... (3 Replies)
Discussion started by: jeco
3 Replies

10. HP-UX

decompress in HPUX11 by Gunzip and gzip

Hello evrebody , I have HPUX-11, i try to install "Mozilla" and "unzip utillity" I cannot decompress file (F.tar.gz) or file(F.gz) by commandes: gunzip -dv F.tar.gz | tar -xvf gunzip F.tar.gz or gzip -dv F.tar.gz |tar -xvf gzip F.gz maybe someone know What's the reason? maybe i... (1 Reply)
Discussion started by: yanly64
1 Replies
Login or Register to Ask a Question