LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How do I make find exclude hidden files (.files) (https://www.linuxquestions.org/questions/linux-general-1/how-do-i-make-find-exclude-hidden-files-files-613793/)

Rotwang 01-15-2008 03:18 PM

How do I make find exclude hidden files (.files)
 
The find command will find all files including those that start with ".". For example if you have a dir with .htaccess in it

find . -type f

will include the .htaccess in the results.

Can I exclude those files? (I guess I could pipe it to grep and somehow do an exclusion maybe?)

(Also how would I do this with tar? The man page for tar says "PATTERN" but doesn't specify what "PATTERN" is. Regex? )

colucix 01-15-2008 03:42 PM

You may use the -regex option, like this
Code:

find . \( ! -regex '.*/\..*' \) -type f
this will exclude also non-hidden files inside hidden directories, anyway.

paulmarc 08-08-2011 03:58 AM

Using the negation modifier
 
You can also use:
Code:

find . -type f -not -name ".*"


All times are GMT -5. The time now is 04:07 AM.