How to decompress files using gunzip?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to decompress files using gunzip?
# 1  
Old 10-24-2018
How to decompress files using gunzip?

I have compressed files under directory '/root/data' and i need the uncompressed files in another directory
'/root/uncom'. I running a shell script below shell script from directory '/root/'

Code:
gunzip /root/data/*.gz -d /root/uncom

But this is failing with :
Code:
gunzip: /root/uncom is a directory -- ignored


Last edited by vbe; 10-25-2018 at 03:09 AM.. Reason: extra code tags
# 2  
Old 10-25-2018
Greetings,
You did not mention your OS, many open sources can have differences depending on architecture... check the man pages.
Here -d to me as gunzip is similar to gzip -d I understand it as decompress and so explains the error message you get:
Code:
gunzip: /root/uncom is a directory -- ignored

you did not mention how you zipped your files, if you have files with gz extensions, copying them in the destination directory and unzipping them there using
Code:
gunzip * or *.gz

should suffice
# 3  
Old 10-25-2018
Code:
for FILE in *.gz
do
        echo gunzip '<' "$FILE" '>' "/path/to/folder/${FILE/.gz/}"
done

Remove the echo and the single-quotes around < > once you have tested and know the filenames / locations are what you want.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Gunzip and edit many files

Experts - I have an requirement to gunzip and edit many files in a pair of directories. I have two scripts that work great when run separately, but I'm having problems combining the two. The goal is to gunzip the files found in the first script and pipe them to the bash/sed script and... (9 Replies)
Discussion started by: timj123
9 Replies

2. 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

3. Shell Programming and Scripting

How to decompress files using gunzip?

I have compressed files under directory '/root/data' and i need the uncompressed files in another directory '/root/uncom'. I running a shell script below shell script from directory '/root/' gunzip /root/data/*.gz -d /root/uncom But this is failing with gunzip: /root/uncom is a directory... (2 Replies)
Discussion started by: vel4ever
2 Replies

4. Shell Programming and Scripting

Decompress (with gunzip) recursively, but do not delete original gz file

Hi all, I have a folder hierarchy with many gz files in them. I would like to recursively decompress them, but keep the original files. I would also like to move all the decompressed files (these are very large HDF5 files with .CP12 extension) to another data folder. Currently I am using four... (3 Replies)
Discussion started by: gansvv
3 Replies

5. Shell Programming and Scripting

Gunzip files

Hi ALL, Am working with the gunzip command to zip all the old files having 10 days am using the command find . -name '*.log' -type f -mtime +10 -exec gunzip {} \; am facing two issues 1.)it displays the files which are all older than a year 2.)when am trying to gunzip all the... (2 Replies)
Discussion started by: thelakbe
2 Replies

6. Shell Programming and Scripting

Gunzip files

Hello Everyone, I have a few files in a directory such as : abc.xyz.txt1.gz abc.xyz.txt2.gz .... .... ... ... abd.xyz.txt100.gz And I want uncompressed files such as: abc.xyz.txt1 abc.xyz.txt2 .... ... ..... .... (1 Reply)
Discussion started by: ad23
1 Replies

7. UNIX for Dummies Questions & Answers

Using gunzip to decompress .zip file

Hi, I have a zipped Oralce software (linux.x64_11gR1_database.zip) and I need to unzip it. On the Linux server, I only see the gunzip utility listed: $ ls -ltr *zip* -rwxr-xr-x 3 root root 60320 Jan 15 2008 gzip -rwxr-xr-x 3 root root 60320 Jan 15 2008 gunzip Can I use the command... (1 Reply)
Discussion started by: syang68
1 Replies

8. UNIX for Dummies Questions & Answers

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... (1 Reply)
Discussion started by: jinxor
1 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