A couple of changes were required to matthewg42's code. The idea was correct, just a minor and/or mixup, and should have used modification time instead of status change time:
Ok, let's generate the test files, and set the modification dates: Code:
$ for month in june july august ; do Now, let's find the correct range of files to delete: Code:
$ find . -type f \( -mtime +14 -o -mtime +60 \) -printf "%Tw %p\n" Code:
$ find . -type f \( -mtime +14 -o -mtime +60 \) -printf "%Tw %p\n" | \ |
Perfect! Thanks a million Mr.C, I created the test env you listed in your post and ran it and it ran perfectly! I also then ran it in the test env i created, just to double check and it was perfect again. If you can, will you give a break down of your final find command that did the actual delete and how it determined what days were what and how removed exactly what was requested?
I could use it to understand Linux better and to write my own script next time. If not, thank you for your time. Also, thanks to Matthew and rab for trying to help me out with this! Hopefully Mr.C post helped you too! |
All times are GMT -5. The time now is 04:50 AM. |