Wednesday, August 13, 2008

Praise for find

I think this might be the most helpful warning message I've ever encountered:

$ find -name 'foo/bar'
find: warning: Unix filenames usually don't contain slashes (though pathnames do). That means that '-name foo/bar' will probably evaluate to false all the time on this system. You might find the '-wholename' test more useful, or perhaps '-samefile'. Alternatively, if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ foo/bar'.

No comments: