Answer the question
In order to leave comments, you need to log in
Will such a command delete a folder older than a certain time?
There is such a script for DB backup.
That is, I store hourly backups in a directory named date.
The last command will delete files.
But as far as I understand correctly, it will not delete directories.
How to delete directories older than a certain time, taking into account that there are no files older than this very specific time?
Answer the question
In order to leave comments, you need to log in
You need to go to Google, search for "find search directories older than",
find the line with directories and add it to the script with the -delete key
find $dest -type d \( -name "*-1[^5]" -o -name "*-[023]?" \) -ctime +30 -exec rm -R {} \; 2>&1
find $dest -type d -name "*-*" -ctime +180 -exec rm -R {} \; 2>&1
How can I make sure that directories older than a certain time are deleted, taking into account that there are no files older than this very specific time?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question