I need to delete folderx which are not accessed for seven days, easily I can do it with next:
find /path/folder -type d -mtime +7 |xargs rm -rf
The probelm is when I have subfolder marked for deletion and parent folder is not, I can do it with with adding
maxdepth 1, but actually it is not solution from top to bottom, I need solution to define from bottom to top where I have
folder 1 (accesed 8 days ago) -> folder 2 (accessed 8 days ago) -> folder 3 (accessed 4 days ago),
With maxdepth 1 it will delete first two and also folder 3 which I don't want do do it.
So actually I need some solution from bottom to top for this. If subfolder is marked for deletion and parent is not etc.