- Find all files named
index.php
using the linux find
command.
- Search in the files for the string
if ( !class_exists( 'WPPluginsOptions' ) )
using the linux grep
command with the -l
flag. (Only output files that match what you are looking for )
- Use the linux
xargs
command to send the list of files from the grep command to the linux rm
command.
All together.
find -L /var/www -iname "index.php" -exec egrep -l 'if ( !class_exists( '"'"'WPPluginsOptions'"'"' ) )' {} + | xargs rm -f
Be careful with this command because it doesn't ask you before deleting files. You should test it in a safe place before running it in production.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…