Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FIND without searching subdirectories 2

Status
Not open for further replies.

MCubitt

Programmer
Mar 14, 2002
1,081
GB
When I use find it searches subdirectories. How can I stop this? The -depth switch seems to be a clue but I am unsure exactly how!

thanks


Applications Support
UK
 
try -prune flag ....
just to be sure use it only to visualize results and not in associations with other commands
 
With prune I seem to get what I want, thanks.

I kind of just discovered it before notification of your post arrived.

So find /home/oracle/* -prune -type flbc
produced:
/home/oracle/err.txt
/home/oracle/findlarg.txt
/home/oracle/mbox
/home/oracle/orapwIFSL
/home/oracle/smit.log
/home/oracle/smit.script

PERFECT!

One side issue, if the folder is empty it returns an error..
"find: 0652-019 The status on /oracledata/DB/backup/* is not valid."

How does one trap this to IGNORE it. Ie, I don't care the fact it is empty but don't want to include the error in the output.

thanks



Applications Support
UK
 
Doh, thanks Ken!


Applications Support
UK
 
Just curious. But why do you use 'find' when u do not want to search subdirs?

Why do not u use ls (or grep instead of find . -exec)

Regds,
Subu
 
Subu:
Because it produced the continuous list with path and file name perfectly well, does LS also do this?




Applications Support
UK
 
Oh true. You are right.
I too used to use find for the same purpose :)
 
I am not exactly sure (have no AIX box near me) but probably running the following you will get full paths...

DIR=/home/oracle/
ls -al $DIR
 
Also, "find" command's -xdev switch searches all sub-directories, but does not span filesystems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top