Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a way to ensure find/sed include hidden files during processing?

share|improve this question

migrated from stackoverflow.com Feb 23 '12 at 0:57

This question came from our site for professional and enthusiast programmers.

    
Can you give an example of what it's not finding? –  Kevin Feb 23 '12 at 2:02
add comment

2 Answers

up vote 2 down vote accepted

Neither find nor sed care about hidden files; if hidden files are being ignored then its because your shell is ignoring them. On bash, set the dotglob option (via shopt -s dotglob) in order to cause globbing to match files that start with a ..

share|improve this answer
    
I don't agree. find enumerates files all on its own, recursively; it does not rely on the shell command-line processing (and indeed often works better when command-line arguments are escaped or quoted to avoid shell processing). –  Ben Voigt Feb 23 '12 at 0:53
add comment

From the find manpage:

-name pattern

Base of file name (the path with the leading directories removed) matches shell pattern pattern. The metacharacters ('*', '?', and '[]') match a '.' at the start of the base name (this is a change in findutils-4.2.2; see section STANDARDS CONFORMANCE below). To ignore a directory and the files under it, use -prune; see an example in the description of -wholename. Braces are not recognised as being special, despite the fact that some shells including Bash imbue braces with a special meaning in shell patterns. The filename matching is performed with the use of the fnmatch(3) library function. Don't forget to enclose the pattern in quotes in order to protect it from expansion by the shell.

So check what version of find you are using, and consider upgrading.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.