I did write a script which checks all php files within a given folder for changes every hour, so I can detect possible code injections and their integrity. It's working so far, but my approach seems a little slow and forks too many ls
processes. Here's the code:
/usr/bin/find /home/www -name "*.php" -exec ls -l \{} \;
Is there a better way?
Please note I need, at a minimum, full path, permissions, owner, group and modification time for each of the files.
Thanks!
Best Answer
Find has a built-in action "-ls" that should do what you need (see below). If that isn't quite the info you're after, you can also use -printf and format directives to control exactly what gets printed.