LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-26-2012, 05:53 AM   #1
BalajiGovardhan
LQ Newbie
 
Registered: May 2012
Posts: 1

Rep: Reputation: Disabled
gzip -cr


Hi,
tried the following


drwx------ 6 oracle oinstall 4.0K May 26 15:12 .
[oracle@INPRJ-ARMCSG01 ~]$ mkdir test_dir
[oracle@INPRJ-ARMCSG01 ~]$ cd test_dir
[oracle@INPRJ-ARMCSG01 test_dir]$ touch abc.txt
[oracle@INPRJ-ARMCSG01 test_dir]$ touch def.txt
[oracle@INPRJ-ARMCSG01 test_dir]$ cd ..
[oracle@INPRJ-ARMCSG01 ~]$ gzip -cr test_dir > test_dir.gz
[oracle@INPRJ-ARMCSG01 ~]$ ls -lhtra
-rw------- 1 oracle oinstall 179 Apr 27 20:19 .Xauthority
-rw------- 1 oracle oinstall 35 May 26 10:43 .lesshst
-rw------- 1 oracle oinstall 14K May 26 13:17 .bash_history
drwxr-xr-x 2 oracle oinstall 4.0K May 26 15:22 test_dir
-rw-r--r-- 1 oracle oinstall 56 May 26 15:22 test_dir.gz
drwx------ 7 oracle oinstall 4.0K May 26 15:22 .
[oracle@INPRJ-ARMCSG01 ~]$ rm -rf test_dir
[oracle@INPRJ-ARMCSG01 ~]$ ls -lhtra
-rw------- 1 oracle oinstall 179 Apr 27 20:19 .Xauthority
-rw------- 1 oracle oinstall 35 May 26 10:43 .lesshst
-rw------- 1 oracle oinstall 14K May 26 13:17 .bash_history
-rw-r--r-- 1 oracle oinstall 56 May 26 15:22 test_dir.gz
drwx------ 6 oracle oinstall 4.0K May 26 15:22 .

Now when I try to uncompress this file it does not take the form of the folder.

tried gunzip -cd test_dir.gz > test_dir

tried gunzip -d test_dir.gz
- no results.

Need help.

Last edited by BalajiGovardhan; 05-26-2012 at 06:39 AM.
 
Old 05-26-2012, 06:37 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
From the gzip man page:
Code:
-r --recursive
              Travel  the  directory  structure recursively. If any of the file names specified on the command
              line are directories, gzip will descend into the directory and compress all the files  it  finds
              there (or decompress them in the case of gunzip ).
gzip -r dirname compresses each file that it finds in dirname, but it does not do anything to dirname

This does not work:
Code:
gzip -r testdir > newfile
the gzip -r command compresses all the file that it finds in testdir, but does not write anything to newfile.

I think you need tar to do what you want----eg
Code:
tar -czf testdir.cmp testdir   ##compresses testdir and its contents into "testdir.cmp"
tar -xzf testdir.cmp           ##recreates testdir and its contents
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to open gzip file? I have gzip installed mhg Linux - Newbie 3 10-24-2008 03:18 AM
gzip help mahmoud Linux - Newbie 7 05-16-2008 08:53 AM
[gzip] appears in process table after gzip command completes redmanDBA Linux - General 0 02-26-2008 07:12 AM
apt-get update error: "gzip: stdin: not in gzip format" haertig Debian 0 08-02-2006 06:21 PM
Solaris 8 gzip issues- cannot gzip -d lynx sixosix Solaris / OpenSolaris 4 03-13-2005 04:17 PM


All times are GMT -5. The time now is 09:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration