Find Any Modified Files for the Past 24 Hours

The following short script will check your files and it would list all files which have been modified in the past 24 hours.

Just copy and paste the code below into a file and then execute the file.


current_status=$(mktemp /tmp/temp-status.XXXXXX)

find ~/public_html/ -mtime -1 -type f -print > ${current_status}

if [[ -s ${current_status} ]] ; then
echo "There are some modified files. See the list below:

cat ${current_status}

echo "

If you have not made any updates or if you
have not installed any new software like plugins and themes,
please check the files"

rm -f ${current_status}

Note that you would need to change the path if your files are not stored at ~/public_html.

Additionally, you could do is to set up this as a Cron job and email the output over each time there are any modified files.

Back to DevDojo