LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   find hidden files from wild card path using 'find' (https://www.linuxquestions.org/questions/linux-newbie-8/find-hidden-files-from-wild-card-path-using-find-907918/)

nagendrar 10-13-2011 05:48 AM

find hidden files from wild card path using 'find'
 
I have normal and hidden files with ".log" extension (Ex: a.log, b.log, .aa.log, .bb.log, .cc.log) in /home/xyz/test directory.

I tried to find the whether .aa.log file exist or not that directory using 'find' command as follows.

$ find /home/xyz/test/*.log -name .aa.log


But i did not get nothing even though ".aa.log" file exists.

I need to find the whether .aa.log file exist or not that directory using 'find' command with wildcard searching directory(Ex: /home/xyz/test/*.log).

Please help me to get his.

ThanQ,
Nagendra

grail 10-13-2011 05:52 AM

Quote:

/home/xyz/test/*.log
How is this a directory to be searched? It looks more like the name of a globbed file.

vivanguarda 10-13-2011 03:35 PM

Can you use another command such as ls -la, locate or grep?


Look at this thread http://www.linuxquestions.org/questi...quives-901509/

Tinkster 10-13-2011 03:47 PM

What grail said: unless you're trying to search a bunch of
directories that have a '.log' extension this isn't going to work.



Cheers,
Tink

jthill 10-13-2011 11:12 PM

Code:

find /home/xyz/test -name \*.log

jschiwal 10-13-2011 11:48 PM

I use ".[^]*" to list hidden files and directories, to eliminate the pattern ".." when looking for hidden file and directories.

"ls .[^.]*" to list files and directories. "ls -d .[^.]*/" to list just hidden directories.

When using the find command, put the name pattern inside quotes or double quotes so the find command reads the wild card.
Escaping the wild cards works, but always putting the file name pattern in quotes makes the pattern stand out.
Use the -maxdepth 1 option to prevent descending into subdirectories. Add -type f or -type d to show only files or directories respectively.


All times are GMT -5. The time now is 04:44 AM.