Find Any Modified Files for the Past 24 Hours

Find Any Modified Files for the Past 24 Hours

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

I usually use this for regular Wordpress, Joomla or custom PHP websites.

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

If you have any questions you can always feel free to contact me.

#!/bin/bash

# This will check your files and let you know
# if any changes have been made in the past 24 hours
# Toy can use this as a cron job

find ~/public_html/ -mtime -1 -type f -print > ~/modified.txt

modified=~/modified.txt

if [[ -s $modified ]] ; then
echo "There are some modified files. See list bellow:

=======================

"
cat ~/modified.txt

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

Regards"
#
#If you wish you can uncomment the following so that you
# could receive a confirmation that the files have not been modified:
#
#else
#	echo "There are no modified files. Relax."
fi;

######## END ##########

 

The other thing that you could do is to setup this as a cron job and email the output over each time there are any modified files.

If anyone needs help with that, please feel free to send me an email.

 

Coffee For Me
Recent Posts
Proxies Demystified
Proxies Demystified
2019-11-05 09:31:05