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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete a file older than 30 minutes old

Status
Not open for further replies.

beaster

Technical User
Aug 20, 2001
225
US
I have a file called alarm_sms.txt I need a command that will delete the file only after it is older than 30 minutes by system time.

Can anyone help?

//beaster
 
Also, when I write to this file during the 30 minutes, can I preserve the file date? I want to avoid writing to the file, it updating the time it was written to, because I would never delete it if it kept updating the time stamp.

Basically, I want to write to the file for 30 minutes and delete it after that.

//beaster
 
What about a cron job which deletes the file every 30 minutes?

Greg.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top