Operating System - HP-UX
1829608 Members
1503 Online
109992 Solutions
New Discussion

Compress a file across disks

 
SOLVED
Go to solution
Debbie Beresford
Frequent Advisor

Compress a file across disks

We currently backup to disk and then compress the file once it is complete. However, we have outgrown our disk and can no longer compress to the same disk. How can I redirect the compressed output to another disk?
5 REPLIES 5
Patrick Wallek
Honored Contributor
Solution

Re: Compress a file across disks

That is easy:

# compress < /dir/to/inputfile > /dir/to/outputfile.Z

The same works for gzip.
Patrick Wallek
Honored Contributor

Re: Compress a file across disks

I should have added that uncompress works the same way.

# uncompress < /dir/to/compressed.Z > /dir/to/uncompressed
Jeff_Traigle
Honored Contributor

Re: Compress a file across disks

You can also pipe the backup through compress (or gzip) directly, thus bypassing one write to disk. Example with tar:

tar cf - /path/to/backup | compress > /path/to/save

Can be done with any other backup utlity as well. Just use stdin (specified by -) as the archive file.
--
Jeff Traigle
Debbie Beresford
Frequent Advisor

Re: Compress a file across disks

Thanks. I was missing the <> and couldn't get it to work.
Debbie Beresford
Frequent Advisor

Re: Compress a file across disks

This has been resolved.