Solved

Avoiding 'Find' to search in subdirectories

Posted on 1997-11-10
6
454 Views
Last Modified: 2010-04-21
I want to perform a search using the 'find' command but I don't want it to search into the subdirectories as it's defaulted to.  I'm under IRIX 6.4
0
Comment
Question by:houde
6 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 2007670
-prune
0
 

Author Comment

by:houde
ID: 2007671
That's what I tried!
If I include it before -name, nothing returned.
If I include it after -name "pattern", I get the same result as without -prune
0
 
LVL 1

Expert Comment

by:delphinus
ID: 2007672
To find a find in the current directory, but not recurse into
subdirectories:

find . -name 'pattern' -maxdepth 1

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:houde
ID: 2007673
maxdepth is not an option of the find command under IRIX 6.4
0
 
LVL 84

Expert Comment

by:ozo
ID: 2007674
find . -print \! -name '.' -prune
0
 
LVL 1

Accepted Solution

by:
Taliesin earned 50 total points
ID: 2007675
Forget Find, and use

 ls -laF [dir] | egrep [reg_exp] | pg

or: ls [dir] | grep [simple_reg_exp]
or the short answer ("find like"):   ls -1 | grep [sub_string]

   if you still want to use find, use -prune at the end of
the sentence, but you must be sure you are making the right
search sequence, and not using "-prune" as part of your
search....

   ... with find, you're using an F-16 to kill flies...


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
create user in TSM 7 588
sudo logging 5 80
Best software for Unix commands in Windows cmd.exe? 18 102
AIX 5.x set up arrow to recall 11 46
Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now