I'm writing an ant script to clean up an archive folder
Here's how I need to clean it up: I need to delete folders old than a certain amount of days AND has more than 3 files in it. So for example if a folder is 300 days old but only has 3 files than it will NOT be deleted.
I know I can ssh into the archive and do find -mtime +365 -exec rm -rf {} ;\
to delete files older than 1 year but I don't know how to account for the minimum of 3 files
I also know that find -type f | wc -l
will list the number of files, but that doesn't really help in terms of scripting
Any ideas?
ANT selectors enable you to customize the fileset to delete.
Try the following: