so I have looked at every single script on here regarding deleting directories older than 14 days. The Script I wrote works with files but for some reason it is not deleting the directories. So here is my scripts.
find /TBD/* -mtim +1 | xargs rm -rf
So this code successfully deleted the FILES inside TBD but it left two directories.
I need to remove files older than 3 days with a cron job in 3 different directories. (these 3 directories are children of a parent directory /a/b/c/1 & /a/b/c/2 & /a/b/c/3) Can this be done with one line in the crontab?
Below is my shell script and it will move the files older than 90 days to archive mount. Now my new requirement is , I need to move some of the directory files older than 365 days. How can I achieve this.
Simply I have
I need to exclude DIR 2 and DIR 2 directory older than 365 days files should be moved to another directory.
I need a command for deleting all the compress files *.Z that are older than the current date - 5 days. Basically I have a directory where daily I meet some back up files and I want to remove automatically the ones 5 days (or more) older than the current date. How can I write a 'rm' command for doing that?
I would like to create a batch file that deletes files (only files, not folders neither subfolders) from different directories (100+ different directories) older than 1 day and have this batch run everyday on task scheduler.
I've found this script , but need to adapt it to delete files in multiple directories...
Any help please on how to achieve this?