0

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/ 

2 Answers 2

1

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' 
0

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"

3
  • General logic is centered around detection of hidden folders in unix. Hidden folder starts with a DOT. Commented Mar 28, 2012 at 7:21
  • The output is still ther same cannot surpass the snapshot directory Commented Mar 28, 2012 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. Commented Mar 28, 2012 at 14:34

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.