LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-15-2008, 04:18 PM   #1
Rotwang
Member
 
Registered: Jan 2004
Distribution: CentOS
Posts: 281

Rep: Reputation: 30
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? )
 
Old 01-15-2008, 04:42 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
You may use the -regex option, like this
Code:
find . \( ! -regex '.*/\..*' \) -type f
this will exclude also non-hidden files inside hidden directories, anyway.
 
Old 08-08-2011, 04:58 AM   #3
paulmarc
LQ Newbie
 
Registered: Jul 2011
Distribution: Fedora
Posts: 11

Rep: Reputation: 4
Post Using the negation modifier

You can also use:
Code:
find . -type f -not -name ".*"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to exclude while moving files? surfbass General 1 07-16-2006 08:48 AM
can't get rsync exclude files Batta Linux - Newbie 1 03-27-2006 11:39 PM
How to make .foo files hidden in Windows underdawg General 2 09-23-2005 04:49 PM
home directory files gone, hidden files remain Grasshopper Linux - Security 12 04-10-2005 09:23 PM
Find hidden executable files Wynd Linux - General 2 06-09-2003 04:09 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration