Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

find command search only non hidden directories

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'


   ls /home/tom/project/
   dir1
   dir2
   .backup
   .snapshot/
   .ignore/
like image 651
Rajeev Avatar asked Mar 28 '12 05:03

Rajeev


People also ask

Does find search hidden directories?

You need to use the find command to list all hidden files recursively on a Linux or Unix like systems. You can also use the ls command to list hidden files.

Does find command search subdirectories?

The find command will begin looking in the starting directory you specify and proceed to search through all accessible subdirectories. You may specify more than one starting directory for searching. Display pathnames of matching files. Execute command cmd on a file.

Which command counts all not hidden files and folders in current directory?

1) Counting files and directories in Directory with tree command. The tree command with the -a option will count all together (files and directories) recursively. The below example shows everything in detail. Remove the '-a' option to exclude hidden files in the tree command output.

How do I exclude a directory in find command?

To exclude multiple directories, OR them between parentheses. And, to exclude directories with a specific name at any level, use the -name primary instead of -path .


1 Answers

Try

find /home/tom/project -type d -name '.*' -prune -o -name .log.txt -print
like image 66
Brian Swift Avatar answered Oct 23 '22 02:10

Brian Swift