Operating System - HP-UX
1820637 Members
1775 Online
109626 Solutions
New Discussion юеВ

How to compress directories?

 
SOLVED
Go to solution
leereg_5
Frequent Advisor

How to compress directories?

I want to compress serveral directories(with all the files and directories under them included). How to perform the task in one shell command?


Thanks a lot!
Always UNIX!
3 REPLIES 3
Laurent Paumier
Trusted Contributor
Solution

Re: How to compress directories?

Use tar/gzip :

# tar cf - dir1 dir2 ... | gzip -9 > archive.tar.gz

Shahul
Esteemed Contributor

Re: How to compress directories?


Hi

U can use compressdir for this.
example

#compressdir /user

Now all files and subdirectories under /user will be compressed.

Shahul
Shahul
Esteemed Contributor

Re: How to compress directories?


Hi

I forgot to add this. U can uncompress this either by uncompressdir or by gunzip command.

Like this

#uncompressdir /user

or

#gunzip -r /user

Shahul