Languages and Scripting

Finding and deleting sub-directories by date

 
TheJuiceman
Super Advisor

Re: Finding and deleting sub-directories by date

By cd into the directory and excluding ".", that does in fact stop the problem.  I would have thought there would be a "cleaner" way to do this.

 

find / -type d -name DIR |\

(

   while read TMP; do

   cd $TMP

   find . ! -name . -depth -mtime +95 -print -exec rm -r +

   done

)

 

Thanks again.