|Liam Delahunty: Home||Tips||Web||Contact|
Think I deserve a present? See my Amazon Wish List
Linux Find files Prune, Ignore Directories, Xargs Grep
find . -path - Find all files in this directory (.) The -path is required as we are going to prune a directory
-prune - ignore the contents of the proceding path './media/'
-iname - files must have php in the name. Specifically end with php
\! -type d - ignore directory names
-print0 - print results in a way that spaces won't screw up the xargs
| - pipe the results of the first command into the second
xargs - build and execute command lines from standard input
-0 - to process arbitrary file names, even those that contain newline characters
grep - Search for the "Term" -i case insensitive -l list only the results.
I use this command to find pages in websites with particular terms, and want to avoid parsing the files of certain directories (media), only for certain file types (*php) and ignore directory names.