Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # Script to scan all your PHP files and look for changes
- #
- # To make the Internal Field Separator to accept spaces
- IFS=$'\t\n'
- # To store the path where this script is located
- SCRIPT_PATH=${0%/*}
- # Go to the path where the script is located
- cd $SCRIPT_PATH
- # Create a string with today's date
- TODAY=`date +%Y%m%d`
- # Create a string for yesterday's date
- YESTERDAY=$(date -d yesterday +"%Y%m%d")
- # The path where your public PHP files are located
- PHP_FILES_PATH=~/
- # Find all the PHP files and save a list containing each file location and the size
- find $PHP_FILES_PATH -type f -iname "*.php" -exec ls -l {} \; | awk '{ print $9 "\t" $5 }' > $TODAY.log
- # Find the difference between today's lists and yesterday's list returning an output only if there is any difference
- diff --side-by-side --suppress-common-lines $TODAY.log $YESTERDAY.log
Advertisement
Add Comment
Please, Sign In to add comment