Solved

Avoiding 'Find' to search in subdirectories

Posted on 1997-11-10
6
453 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
Comment Utility
-prune
0
 

Author Comment

by:houde
Comment Utility
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
Comment Utility
To find a find in the current directory, but not recurse into
subdirectories:

find . -name 'pattern' -maxdepth 1

0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

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

Expert Comment

by:ozo
Comment Utility
find . -print \! -name '.' -prune
0
 
LVL 1

Accepted Solution

by:
Taliesin earned 50 total points
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
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.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

762 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

13 Experts available now in Live!

Get 1:1 Help Now