1837409 Members
3661 Online
110116 Solutions
New Discussion

compress misinformation

 
eric stewart
Frequent Advisor

compress misinformation

Here is my Q.
Has anyone gotten messages from compress that seem to be erronious?

I used find to see if there were any compressed files in a directory. THere were none.
I then ran compress -f on the files in that directory and compress said there were already compressed files?

Any ideas or is there a fix that I missed?

partial log of problem:

>find T1461A -type f -print|grep Z
>find T1461A -type f -exec compress -f {}\;
T1461A/MRBIG/NETOSTEO/DATABASE/abfappl.rb.Z: already has .Z suffix -- no change
T1461A/MRBIG/NETOSTEO/DATABASE/bsnova.rb.Z: already has .Z suffix -- no change
T1461A/MRBIG/NETOSTEO/DATABASE/copyvt.out.Z: already has .Z suffix -- no change
Good help is easy to find within forums
4 REPLIES 4
Vikas Khator
Honored Contributor

Re: compress misinformation

Hi ,

Let me try explaining it .

First time when you do a find you have no Z files so you do not get any.

Next find finds a file for e.g. abc and sends this to compression routine . The compression routine creates a new file abc.Z .

As find continues to execute further it also comes across a file abc.Z ( created earlier from a file abc ) and complains .

Try following and see if it fixes your problem :

find T1416A -type f |xargs compress
Keep it simple
Bruce Regittko_1
Esteemed Contributor

Re: compress misinformation

Hi,

I suspect what happened is that find found the first file and compressed it. Then find found the "new" file and tried to compress it again only now it had the .Z extention.

The man page for find(1) suggests using a + instead of a ; to punctuate the command. This will allow the -exec command to operate on the aggregated set of pathnames and execute on the set instead of one file at a time. This will also greatly improve performance since there will only be one compress command generated.

--Bruce
www.stratech.com/training
Bruce Regittko_1
Esteemed Contributor

Re: compress misinformation

Hi again,

I've never used the + before in a find command and just now found it rather flakey. In order for it to work correctly, I had to put a null argument before the {}. Thus,

find /dir -name "whatever" -exec command -opt "" {} \+

Without the "", -opt is ignored. I wonder if this is an undocumented "feature" or a bug.

--Bruce
www.stratech.com/training
eric stewart
Frequent Advisor

Re: compress misinformation

vikas,
if your theory is correct, how come it does not happen on every file?
TX
Eric
Good help is easy to find within forums