Thanks everyone. I have tried to get these commands to work;however, the -mtime is not recognized. The commands deletes the entire directory, which I want to keep 6 months. (see commands used below) Any other scripts out there created to do this function, or ideas.
I am using AIX and need to create a script that deletes sub directories under a directory. These sub-directories are over a year an a half old or more. I need to keep only five months and need it to run monthly to only keep five months from this point. I have tried the -mtime commands, and nothing seems to really work with deleting directories. Anyone with any suggestions?
Supplied function:
find <dirname> -type d -mtime -180 -exec rm -rf {} \;
I am using AIX and need to create a script that deletes sub directories under a directory. These sub-directories are over a year an a half old or more. I need to keep only five months and need it to run monthly to only keep five months from this point. I have tried the -mtime commands, and nothing seems to really work with deleting directories. Anyone with any suggestions?
Supplied function:
find <dirname> -type d -mtime -180 -exec rm -rf {} \;