Re: find command tweak

From: cbaker@GOODYEAR.COM
Date: Fri Mar 12 2004 - 14:44:36 EST


That is definitely better. Let me add this

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

That will go ahead and compress any files it finds so you don't have to run
two commands.
You can add exclusions to the above find if you have other restrictions or
other types of compressed/zipped files.

2) Why worry about compressing (or gzipping) an already compressed file.
It will just tell you it is already compressed and then will skip it.

Christopher M. Baker
Senior Technical Support Analyst
DSE/TCO
Goodyear Tire and Rubber Company

=================================================
Contains Confidential and/or Proprietary Information.
May not be copied or disseminated without the expressed
written consent of The Goodyear Tire & Rubber Company.
=================================================

                      "Harvey, Bruce T."
                      <BTHarvey@LMUS.LEG To: aix-l@Princeton.EDU
                      GMASON.COM> cc: (bcc: Chris Baker/NA/GDYR)
                      Sent by: IBM AIX Subject: Re: find command tweak
                      Discussion List
                      <aix-l@Princeton.E
                      DU>

                      03/12/2004 02:12
                      PM
                      Please respond to
                      IBM AIX Discussion
                      List

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
Legg Mason Wood Walker, Inc.
Corporate Technology - UNIX Admin.
Red Run 2nd Floor - Owings Mills, MD
(410) 580-7383 - BTHarvey@LeggMason.com
-------------------------------------------------------

-----Original Message-----
From: Bob.Kelley@BRINKSINC.COM [mailto:Bob.Kelley@BRINKSINC.COM]
Sent: Friday, March 12, 2004 1:35 PM
To: aix-l@Princeton.EDU
Subject: find command tweak

I'm trying to figure out a slick find and or ls command variation to do
the following:

I want to compress all files in "/archivefiles" with the following
requirements:
-files not already compressed
-do not compress files modified in the last two days

I was thinking something along the lines of:
find . -type f -mtime -2 -print > /archivefiles/do_not_compress_these.out
ls -lart|grep arch|grep -v Z|awk '{print $9}' >
/archivefiles/all_files_list.out
diff do_not_compress_these.out all_files_list.out >
actual_files_to_compress.out

Am I making this too hard?????????

Bobby Kelley Jr.
972-877-5341
IMPORTANT: The security of electronic mail sent through the Internet
is not guaranteed. Legg Mason therefore recommends that you do not
send confidential information to us via electronic mail, including social
security numbers, account numbers, and personal identification numbers.

Delivery, and timely delivery, of electronic mail is also not
guaranteed. Legg Mason therefore recommends that you do not send
time-sensitive
or action-oriented messages to us via electronic mail, including
authorization to "buy" or "sell" a security or instructions to conduct any
other financial transaction. Such requests, orders or instructions will
not be processed until Legg Mason can confirm your instructions or
obtain appropriate written documentation where necessary.



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