KrisChase.com

Find all files touched within the last 2 weeks

Posted in Web Development on 06.10.2015 by @chasebadkids

If you’ve ever had to deal with a hack before, you know how frustrating it can be figuring out what files were infected.  This is a great method for finding all the PHP and JavaScript files that have been touched within the last couple of weeks.  Obviously you can easily change / add more file types and increase / decrease the time to search through.

find . -type f \( -iname \*.php  -o -iname \*.js \) -mtime -14 -exec stat -c "%n %y" {} \;

What sort of files were you able to clean up using this script?  Leave feedback below!

Menu