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/
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.
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.
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.
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 .
Try
find /home/tom/project -type d -name '.*' -prune -o -name .log.txt -print
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With