-1

I need shell script that runs every half an hour on cron and removes the files with extension (*.arc) that are 1 hour ,

old i tried mtime but that has a option only for days old not in terms of hours

it would be helpful if i can get a command or some logic which can run on all types of OS meaning (hp-ux,linux,rhel etc)

edit:(some of the servers in my work environment have OS that dont have mmin option is there a work around)

can anyone please tell how i wud use tmpwatch or temreaper do delete files (*.arc) older than 1 hr

thank you

user3186568
  • 61
  • 1
  • 9

1 Answers1

1

Maybe this can help you

How to delete files older than X hours

Seems to do what you are wanting to do!

Edit!

Maybe considerd kind of a hack, but maybe you code do something like this

touch -t 03061000 /tmp/datefile

This is supposed to create a file with a time stamp of March 6th 10:00

Next you can issue the command

find . -newer /tmp/datefile -print

to find the files thare are newer than this file and remove them.

Hope this helps!

Community
  • 1
  • 1
Daniel Hansen
  • 251
  • 2
  • 3
  • 11