# search for a pattern
grep -iar "<?php" | cut -d':' -f 1 > phpfiles.txt
#remove recursed
cat phpfiles.txt | grep -vP "php.*" > phpfiles.txt.filtered
# check if any remaining files to move
wc -l phpfiles.txt.filtered
# move found files
cat phpfiles.txt.filtered | xargs -i mv '{}' ./php/