[HPADM] RE: script

From: COUPRIE Kees (Kees.COUPRIE@swift.com)
Date: Wed Aug 11 2004 - 02:32:10 EDT


First of all -atime checks for the access time, not the creation time.
For the creation time, use -ctime.
 
In stead of calculating the number of fays, try this:
 
        touch -amc -t 200312312359.59 /tmp/20040101.tmp
        find ./PMAB1* ! -newerc /tmp/20040101.tmp -exec blah blah yada
yada
        rm /tmp/20040101.tmp
 
The first command (touch) creates a temporary file with creation,
modification and access date all on December 31, 2003, one second
before midnight.
The second command (find) searches for files that are NOT ( "!" stand
for "not") newer, i.e. older or just as old) as the temporary file. In
effect that means all the files created before 2004. Of course blah blah
yada yada should be replaced by whatever command you wish to let loose
on your files.
The last command (rm) removes the temporary file. (duh)
 
Notes:
        * not all Unices support -newerc
        * Some Unices may support -older, which is (more or less) the
same as ! -newer
        * -newerc compares the creation dates, -newera compares the
access date, -newerm compares the modification data.

Best regards,
Kees Couprie

________________________________

        From: hpux-admin-owner@DutchWorks.nl
[mailto:hpux-admin-owner@DutchWorks.nl] On Behalf Of Hutchins, Greg
        Sent: Tuesday, August 10, 2004 21:45
        To: Hpux-Admin@Dutchworks. Nl (E-mail)
        Subject: [HPADM] script
        
        

        Hi all! Looking for a script to find files and move them if
they were created before 2004. I used find ./PMAB1* -atime +221 -xargs
-I {} mv. I wanted to know if there is a simpler way to compare dates
without having to calculate the 221 days manually. Thanks for any help


--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:42 EDT