Operating System - HP-UX
1832877 Members
2301 Online
110048 Solutions
New Discussion

Re: Zip an entire directory before save keepin the data

 
Shermaine
Occasional Advisor

Zip an entire directory before save keepin the data

Hi I would like to zip a directory of files while using "gzip *.*" or "ls | xargs gzip"
both prompted me arg list too long.
Can someone kindly advise me on how o overcome this. Thank you!
3 REPLIES 3
H.Merijn Brand (procura
Honored Contributor

Re: Zip an entire directory before save keepin the data

Why zip all the files seperately?

# tar cvf - *.* | gzip -9 > ../archived.tgz

If you still want to do every file on itself

# find . -type file -name '*.*' -exec gzip -9 {} \;

but that will also go into subfolders

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Robert-Jan Goossens
Honored Contributor

Re: Zip an entire directory before save keepin the data

Hi,

Merijn's gave you the tar solution. You could try somethink like this.

# ls | while read LINE
do
gzip $LINE
done

Robert-Jna
sam_111
Trusted Contributor

Re: Zip an entire directory before save keepin the data

hi,

using tar would be the best.

regards,

sam
"Hard Work always Pays off"