Solved

gunzip

Posted on 2004-04-02
7
1,026 Views
Last Modified: 2009-07-29
I have directory of files of extension .GZ i did GUNZIP in one folder. is there any method that gunzip continues to next folder after finishing 1st folder.
my aim is to unzip all the folders in particular directory in single command.
is there any possible way...

TIA
0
Comment
Question by:kousis
7 Comments
 
LVL 25

Expert Comment

by:lwadwell
ID: 10739261
The version of gzip and gunzip that I use supports recursion...

in the parent directory I can type

gzip -r *

and all file in the parent directory and its subdirectories are zipped, conversely

gunzip -r *

will unzip them all.
0
 
LVL 83

Expert Comment

by:oBdA
ID: 10739581
The following command will do that:

for %a in ("Y:\our\directory\*.gz") do gunzip %a

If you want to use this in a batch script, replace the "%a" with "%%a".
0
 

Author Comment

by:kousis
ID: 10739764
for %a in ("Y:\our\directory\*.gz") do gunzip %a

This command is not unzipping the files.
is there anyway to do this,
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 83

Expert Comment

by:oBdA
ID: 10740140
If gunzip.exe is not in the path, you'll have to specify the full path of the exe:
for %a in ("Y:\our\directory\*.gz") do "T:\he\install\directory\gunzip.exe %a
And just to be sure: you did replace the path to the directory with your path ("Y:\our\directory\*.gz")?
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 10830186
if gunzip.exe is in msdos7 folder for example  do like this

set path=%path%;c:\msdos7

and call as above explained
0
 
LVL 14

Accepted Solution

by:
sudhakar_koundinya earned 100 total points
ID: 10830203
create myunzip.bat

and enter following code in it

@echo off
set path=%path%;c:\msdos7
rem assuming gunzip.exe in msdos7 directory
 for %a in ("Y:\our\directory\*.gz") do gunzip %a


at command prompt execute like this
myunzip mydirectory
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question