LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 10-13-2011, 04:48 AM   #1
nagendrar
Member
 
Registered: Apr 2008
Location: HYD, INDIA.
Posts: 141

Rep: Reputation: 15
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
 
Old 10-13-2011, 04:52 AM   #2
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,516

Rep: Reputation: 1896Reputation: 1896Reputation: 1896Reputation: 1896Reputation: 1896Reputation: 1896Reputation: 1896Reputation: 1896Reputation: 1896Reputation: 1896Reputation: 1896
Quote:
/home/xyz/test/*.log
How is this a directory to be searched? It looks more like the name of a globbed file.
 
Old 10-13-2011, 02:35 PM   #3
vivanguarda
Member
 
Registered: Sep 2008
Location: RJ-Brazil
Distribution: Slackware
Posts: 166

Rep: Reputation: 4
Can you use another command such as ls -la, locate or grep?


Look at this thread http://www.linuxquestions.org/questi...quives-901509/
 
Old 10-13-2011, 02:47 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
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

Last edited by Tinkster; 10-13-2011 at 02:48 PM.
 
Old 10-13-2011, 10:12 PM   #5
jthill
Member
 
Registered: Mar 2010
Distribution: Arch
Posts: 209

Rep: Reputation: 65
Code:
find /home/xyz/test -name \*.log
 
Old 10-13-2011, 10:48 PM   #6
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I make find exclude hidden files (.files) Rotwang Linux - General 2 08-08-2011 03:58 AM
Install libclamav with PHP *cannot find clamav files in default path* j.smith1981 Linux - Software 8 05-27-2011 05:32 AM
[SOLVED] Delete regular files (not hidden files) with find + rm in one line older than 15 Virtuose Linux - Newbie 1 01-08-2011 05:24 PM
[SOLVED] 'find' command regex to exclude hidden files? arashi256 Linux - Newbie 3 06-28-2010 08:53 AM
Find hidden executable files Wynd Linux - General 2 06-09-2003 03:09 AM


All times are GMT -5. The time now is 03:26 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration