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

Removing files

Status
Not open for further replies.

Chacalinc

Vendor
Sep 2, 2003
2,043
US
I was reading the thread822-924121 and I also need to remove files from a specific folder. This folder is for Oracle archived logs and I need to remove all the files that were created (in the same day!) before 22:00 hours. I mean, erase all files between 22:00 hrs. yesterday to 22:hrs. today.

this cron should be running everyday at 22:01 or 22:30 (after 22:00)

I was reading the man for find, but mtime is in a day basis.

Thanks in advance for your help.
 
BTW, using the thread I can delete files older than one day:

# find . \( -type d ! -name . -prune \) -o \( -type f -mtime +1 -exec rm {} \; \)

so the problem is to delete files older than 22:00 hrs.

Thanks.
 
man date
man touch
man find (for ! -newer)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
great! thanks PHV, you get me in the right direction:

# echo "mark file..." > mark.txt
# touch -m -t `date "+%m%d"`2200 mark.txt
# find . \( -type d ! -name . -prune \) -o \( -type f ! -newer mark.txt -exec rm {} \; \)

thanks a lot!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top