in reply to rm old directory
unix%> /usr/bin/find . -type d -mtime +60 -exec /bin/rm -rf {} \;
- replace "." with the directory you want to search below
- "-type d" says "directories"
- "-mtime +60" says "not modified in 60 days" (also consider "-atime" for "last accessed (aka "read") time" or "-ctime" for "change time", depending on how you measure "age".)
- "-exec" passes matching directory names to "/bin/rm -rf".
Edited: per moritz's suggestion, recommend "mtime" instead of "atime" although it's all up to you...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: rm old directory
by moritz (Cardinal) on Jul 22, 2008 at 20:56 UTC | |
by Argel (Prior) on Jul 23, 2008 at 00:06 UTC |
In Section
Seekers of Perl Wisdom