Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

In the following command i want to search only only the directories which are non hidden how can i do this using the following command .Iwant to ignore hidden directories while searching the log file

  find /home/tom/project/ -name '.log.txt'    

Output:

    /home/tom/project/.log.txt
    /home/tom/project1/.log.txt

     find: Filesystem loop detected; ./.snapshot/hourly.0' has the same device number and inode as a directory which is 2 levels higher in the filesystem hierarchy. 
     find: Filesystem loop detected; ./.snapshot/hourly.1' has the same device number and inode as a directory which is 2 levels higher in the filesystem hierarchy.

I want eliminate all the find messages or do not serach in the hidden directory

  ls /home/tom/project/  
  dir1   
  dir2  
 .backup 
 .snapshot/
 .ignore/ 
share|improve this question
add comment

2 Answers

If you just want to ignore the error messages then redirect stdout to a file or /dev/null

find /home/tom/project/ -name '.log.txt' 2>/dev/null

If you may be interested in other error messages but not the particular ones you mention in your question then pipe the output through grep -v

find /home/tom/project/ -name '.log.txt' | grep -v 'Filesystem loop detected'
share|improve this answer
add comment

Try
find . -name '.log.txt' ! -wholename ".*.*/.log.txt"

Find all files with name = .log.txt, but also make sure file full path does not contain more than one DOT in the folder section. First dot is current directory.

If instead of current directory, an absolute path is provided, use following command
find . -name '.log.txt' ! -wholename "*.*/.log.txt"

share|improve this answer
    
General logic is centered around detection of hidden folders in unix. Hidden folder starts with a DOT. –  bbaja42 Mar 28 '12 at 7:21
    
The output is still ther same cannot surpass the snapshot directory –  Rajeev Mar 28 '12 at 9:10
    
The find command will still check all sub directorys, but it will show in output only the ones with correct match. It seems taht Iain's answer could help you in that regard. Note, I don't understand why is that error shown, since find ,by default, does not follow any links. –  bbaja42 Mar 28 '12 at 14:34
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.