I have a folder with a bunch of files. I need to delete all the files created before July 1st. How do I do that in a bash script?
This should work:
find /file/path ! -newermt "Jul 01"
To find the files you want to delete, so the command to delete them would be:
find /file/path ! -newermt "Jul 01" -type f -print0 | xargs -0 rm