How to created a list of PHP files that have been modified for the past twenty four
August 24th, 2009
find /home/web1/public_html -type f -daystart -mtime -1 -exec ls -l {} \;
| egrep -v "(xls$|jpg$|png$|gif$|tif$)" > /root/files_last_modified.txt
I have given an explanation of each flag used in the above command as well.
- /home/web1/public_html , specifies the directory to search, in this case the website document root
- -type f , will only search for files and not directories
- -daystart , will tell find to start with today date
- -mtime, tells find to include every thing that was modified on and before a twenty fours hour period
- -exec ls -l {}, will fun the ls -l command on each results
- | , will redirect the output to another binary, in this instance egrep
- The egrep flags will only display files that do not end in xls,jpg,png,gif, and tif.
Categories: System Administrator's Guide