[HPADM] RE: script

From: Hutchins, Greg (ghutchins2@selfregional.org)
Date: Wed Aug 11 2004 - 09:08:09 EDT


Thanks for all the replies. The most common answer (and simplest for me
to implement) was to touch a file and base the comparison on that which
worked well.

 

 

 

-----Original Message-----
From: Willeat, Todd []
Sent: Tuesday, August 10, 2004 4:58 PM
To: Hutchins, Greg
Subject: RE: [HPADM] script

 

You can use date+%j for the Julian date. Try this:

 

find ./PMAB1* -atime +`date +%j` -xargs -I {} mv

 

 

 

 

 

-----Original Message-----
From: Marlou Everson []
Sent: Tuesday, August 10, 2004 5:43 PM
To: Hutchins, Greg
Subject: Re: [HPADM] script

 

date +%j gives you the Julian day (day of the year as a three-digit
decimal number).

 

Marlou

 

 

 

 

 

 

 

 

-----Original Message-----
From: Bob Vance []
Sent: Tuesday, August 10, 2004 6:12 PM
To: Hutchins, Greg
Subject: RE: [HPADM] script

 

You could touch a file with -m option to set the date to 0:0:0 20040101
and then do a find -newer.

On Linux, it's

     touch -m -t <timestamp> file

.

Don't have access to HPUX right for that exact syntax.

 

 

-----Original Message-----
From: Totsch, David Lee

Sent: Tuesday, August 10, 2004 6:21 PM
To: Hutchins, Greg
Subject: RE: [HPADM] script

 

Greg:

 

Depends on how sneaky you are and if you have root access...you could
touch a file and give it a back-date using the -t option, then

 

    find /PMAB1* ! -newer touched_file

 

notice the "not" directive, so "not newer than touched_file, so, if you
created touched_file with

 

    touch -t 200401010000 touched_file

 

it will return all file in /PMAB1* that are newer than touched_file
(01/01/2004)

 

-dlt-

 

 

 

 

 

-----Original Message-----
From: ami.kumar@tcs.com []
Sent: Wednesday, August 11, 2004 2:08 AM
To: Hutchins, Greg
Subject: Re: [HPADM] script

 

 

 

create one file of your date (01-jan-2004) as

touch -t <YYYYMMDDHHMM> <file name>

touch -t 20040101 new_file

 

Then run find command as

 

find ./PMAB1* -newer new_file -exec mv {} \;

or

 find ./PMAB1* -newer new_file ?xargs ?I {} mv

 

 

 

 

 

 

 

 

Greg,

 

The find in HP-UX does not have a -xargs option so I'm not sure what
you're attempting to do, but to find files created before 2004

you could do this:

 

- - - - - snip - - - - -

touch -t 200401010000.00 /tmp/foobar

find ./PMAB1* ! -newer /tmp/foobar -print

rm /tmp/foobar

- - - - - snip - - - - -

 

The touch command will create a file with a timestamp of midnight
January 1, 2004 and the find will find all the files that are NOT

newer than the temp file (i.e.: before 2004).

 

HTH

 

 Bill Thompson

 Sr UNIX Systems Administrator

 The Goodyear Tire & Rubber Company

 6-0599

 

 Contains Confidential and/or Proprietary Information.

 May Not Be Copied or Disseminated Without Express Consent of The
Goodyear Tire & Rubber Company.

 

 

 

 

 

 

 

-----Original Message-----
From: Hutchins, Greg
Sent: Tuesday, August 10, 2004 3:45 PM
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