Re: find command tweak

From: Bill Thompson (bill.thompson@GOODYEAR.COM)
Date: Fri Mar 12 2004 - 15:07:58 EST


One note of caution - If you are processing lots of files then this syntax:

find /archivefiles -type f -mtime +2 ! -name "*.Z" -print -exec compress {}
\;

is very inefficient as it has to spawn another process for each file it
encounters.

For processing a large group of files, this will run much faster:

find /archivefiles -type f -mtime +2 ! -name "*.Z" -print | xargs compress

Bill Thompson
Sr UNIX Systems Administrator
The Goodyear Tire & Rubber Co.

Contains Confidential and/or Proprietary Information
May Not Be Copied or Disseminated Without Express Consent of The Goodyear
Tire & Rubber Company.

AIX-L Archives: http://marc.theaimsgroup.com/?l=aix-l&r=1&w=2

----- Original Message -----
From: "Kevin Crocker" <kevin@TEQ.NET>
Newsgroups: bit.listserv.aix-l
To: <aix-l@Princeton.EDU>
Sent: Friday, March 12, 2004 2:41 PM
Subject: Re: find command tweak

> At 01:29 PM 03/12/2004 -0600, you wrote:
> >Thanks for that. Now how to go about the compress on all the files
except
> >*.Z and output from that find command??? any slick ideas?
> >
> >Bobby Kelley Jr.
>
> >what about ...
> >
> > find /archivefiles -type f -mtime +2 ! -name "*.Z" -print
> >
> >
> >Assuming you're using 'compress' ... change to *.gz for gzip, etc.
> >
> >Bruce T. Harvey
>
>
> How about adding to the command something like:
>
> find /archivefiles -type f -mtime +2 ! -name "*.Z" -print -exec compress
> ... {} \;
>
> of course using the proper form of the compress command
> not very efficient but it should work
>
> Kevin



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:42 EDT