1846877 Members
4088 Online
110256 Solutions
New Discussion

compress problem

 
SOLVED
Go to solution
Michael Murphy_2
Frequent Advisor

compress problem

anyone ever have a problem where you try to compress a file, but the command comes back with no error and the file is not compressed?
thanks...
10 REPLIES 10
Helen French
Honored Contributor

Re: compress problem

Which command did you use? Which OS?
Life is a promise, fulfill it!
hpuxrox
Respected Contributor

Re: compress problem

you might want to check the command itself.
what /bin/gzip or whatever.

Ken Penland_1
Trusted Contributor

Re: compress problem

well, no, not with compress, but I have seen it with gzip, that was because I was using wildcards... are you just trying to compress a single file and typing it all out, not using wildcards?
'
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: compress problem

That is entirely possible if the file is not compressible. You can use the -f option to force it. Man compress for details.

As a trivial example, do this:
cd /var/tmp
cp /dev/null xx
ls -l xx*

Now,
compress xx
You will note that no error was generated and if you now do an ls -l xx*, you will see that the file remains unchanged.

If it ain't broke, I can fix that.
Michael Murphy_2
Frequent Advisor

Re: compress problem

unix compress command, HP-UX 11.0. I was trying to compress the contents of a oracle cd that was copied to disk. I assume that the previos expanation about compress not making the file any smaller is the culprit.

Thanks all...
doug mielke
Respected Contributor

Re: compress problem

it could be that it's already compressed. (and it's possible to compress a compressed file, and have the output be even larger than the orig.)
Bill Hassell
Honored Contributor

Re: compress problem

Quite normal. compress does nothing if there will be no reduction in size after compressing. Binary executables are often uncompressable. If you force compression usinf -f, the resultant file(s) will generally be slightly larger than the original.


Bill Hassell, sysadmin
Michael Murphy_2
Frequent Advisor

Re: compress problem

Thanks for all responses - yes the file could not be further compressed. It would just be nice if the command told you what it knows (sort of like mkdir - if you run try to make a directory that is already there - it tells you about it - go figure!!!)
A. Clay Stephenson
Acclaimed Contributor

Re: compress problem

I have gone and figured and the difference is that the one case (duplicate directory is an error) and the other (an umcompressible file) is not. The system in no way corrupts or alters the file if it can't be compressed. A good analogy would be ls | grep "Furpsplat" (and I assume that you have no file named "Furpsplat") nothing is returned but it's not an error either BUT grep does let you know that nothing was matched by returning a non-zero exit status which can be determined using ${?}. In a similar manner, eventhough it is not an error, compress lets you know that nothing was done by returning 2 rather than 0 for its exit status.

This is rather typical of UNIX commands.


If it ain't broke, I can fix that.
Bill Hassell
Honored Contributor

Re: compress problem

As an Southern gentleman once told me about computers:

"Y'all want friendly, yer gonna have to git yurself a dawg!"

Of course, all issues like this are easily fixed with wrappers and aliases. Just rename compress to compress.real and write a script that puts out useful messages for all the conditions.


Bill Hassell, sysadmin