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 dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find command help. 3

Status
Not open for further replies.

jvbpro

Programmer
May 27, 2002
9
CA
Hi all,

Does anyone know how to get all the file in a directory, but not in the subdirectory? I don't want to return any files that are in a subdirectory. Any help is appreciated.

Thank you in advance.
Jeya
 
find [some dir] -only -prune -name * -print Robert G. Jordan
Unix Sys Admin
Sleepy Hollow, Illinois U.S.A.
sh.gif


FREE Unix Scripts
 
Hi Jeya,

the find you 're looking for is (assuming you are in the directory that you want to start):

find . \( -type d ! -name . -prune \)

(the ! -name . is necessary because otherwise only . is displayed!)

If you want a long output:

find . \( -type d ! -name . -prune \) -exec ls -ld {} \;

Cheers,

mrjazz [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top