How Do You Delete Files That Were Modified More Than Three Days Ago?

Problem scenario
In Linux you want to delete files that have not been modified in the past three days from the /tmp/ directory. What do you do?

Solution
Run this: find /tmp/ -maxdepth 1 -type f -atime -3 -ls | awk '{print $NF}' | rm -rf

Leave a comment

Your email address will not be published. Required fields are marked *