daily pastebin goal
94%
SHARE
TWEET

Find local PHP file changes

rodrigopolo Aug 9th, 2012 160 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. #
  3. # Script to scan all your PHP files and look for changes
  4. #
  5.  
  6. # To make the Internal Field Separator to accept spaces
  7. IFS=$'\t\n'
  8.  
  9. # To store the path where this script is located
  10. SCRIPT_PATH=${0%/*}
  11.  
  12. # Go to the path where the script is located
  13. cd $SCRIPT_PATH
  14.  
  15. # Create a string with today's date
  16. TODAY=`date +%Y%m%d`
  17.  
  18. # Create a string for yesterday's date
  19. YESTERDAY=$(date -d yesterday +"%Y%m%d")
  20.  
  21. # The path where your public PHP files are located
  22. PHP_FILES_PATH=~/
  23.  
  24. # Find all the PHP files and save a list containing each file location and the size
  25. find $PHP_FILES_PATH -type f -iname "*.php" -exec ls -l {} \; | awk '{ print $9 "\t" $5 }' > $TODAY.log
  26.  
  27. # Find the difference between today's lists and yesterday's list returning an output only if there is any difference
  28. diff --side-by-side --suppress-common-lines $TODAY.log $YESTERDAY.log
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top