Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

removing files - time based

Status
Not open for further replies.

MarkElls

Programmer
Aug 26, 2003
57
GB
I need a bit of help. I want to write a ksh file that will do the following.
look at the time a file was created if the toime is older than 30 miutes then copy it to another directory.

Any suggestions?
Thanks.
 
touch a reference file and use test option "-ot" older than

"example" I do not program in ksh, i prefere csh, please code yourself...
"now" its 13:30 so you need a referencefile with timecode 13:00
touch -t `date '+%m%d'`1300 reffile
do a foreach loop over all your files and
test loopfile -ot reffile
-> mv
else
-> keep it

Regards
-- Franz
Sorry I'm not a native spaeker, I'm from Munich, Germany - "Home of the Whopper", oh no, "Home of the Oktoberfest" ;-)
Solaris System Manager; I used to work for Sun Microsystems Support (EMEA) for 5 years
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top