LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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, 03: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, 03:42 PM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,503

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
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, 03: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 07:48 AM
can't get rsync exclude files Batta Linux - Newbie 1 03-27-2006 10:39 PM
How to make .foo files hidden in Windows underdawg General 2 09-23-2005 03:49 PM
home directory files gone, hidden files remain Grasshopper Linux - Security 12 04-10-2005 08:23 PM
Find hidden executable files Wynd Linux - General 2 06-09-2003 03:09 AM


All times are GMT -5. The time now is 07:26 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration