Operating System - HP-UX
1819734 Members
2954 Online
109606 Solutions
New Discussion юеВ

find and do command needed

 
SOLVED
Go to solution
Jayson Hurd_2
Advisor

find and do command needed

I am looking for a command that will find any .gz file recursively and unzip it. I am trying this:

find /test/test2 -name *.gz -exec gunzip -v {}\;

This is returning an error with the find piece. Can anyone suggest a valid command to accomplish this in HPUX 11i?

Most things worth having don't come easily.
4 REPLIES 4
curt larson_1
Honored Contributor
Solution

Re: find and do command needed

put quotes around '*.gz' and be sure that there is a space between the {} and \;

find /test/test2 -name '*.gz' -exec gunzip -v {} \;
A. Clay Stephenson
Acclaimed Contributor

Re: find and do command needed

The problem is your -name argument; it expects EXACTLY 1 argument and *.gz supplies n arguments. The solution is to change *.gz to '*.gz' so that the find command rather than the shell will do the wildcarding/filename expansion.
If it ain't broke, I can fix that.
John Poff
Honored Contributor

Re: find and do command needed

Hi,

You probably need quotes to protect the asterisk from getting expanded by the shell. Try this:

find /test/test2 -name '*.gz' -exec gunzip -v {} \;

JP
Jannik
Honored Contributor

Re: find and do command needed

for i in $(find /test/test2 -name *.gz)
> do
> gunzip -v $i
> done
jaton