Small blog about system administration.

HOWTO: Delete old directories from the commandline

The first one works quietly, while the second one will display what is being deleted. 
These are probably faster than putting it into a for loop, so feel free to use whatever works best in your particular situation!

# find /home/backup/ -maxdepth 1 -type d -mtime +7 -exec rm -r {} \;

# find /home/backup/ -maxdepth 1 -type d -mtime +7 -exec echo “Removing Directory => {}” \; -exec rm -rf “{}” \;

No comments :

Post a Comment