Operating System - HP-UX
1834903 Members
2727 Online
110071 Solutions
New Discussion

Remove files with date criteria

 
Michele Schwob
Occasional Contributor

Remove files with date criteria

I want to create a daemon that remove files in a specified directory (temp
dirctory). I want this procedure to delete files that are older than a month
ago. How to do that with unix command? The rm and mv command doesn't include
parameter for date criteria!!

Thanks for help me.
1 REPLY 1
Bruce Regittko_3
New Member

Re: Remove files with date criteria

The find command has a criteron that will do what you want. The find command
can also remove files as well. Check the man page first, but I beleive the
following is what you want: find /tmp -atime +30 -exec rm {} \;

Bruce