This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes Find with out recursive Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Find with out recursive" Watch "Find with out recursive" New topic
Author

Find with out recursive

saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
Can anyone tell me how to find a file in the present working directory without recursively searcing the file in its sub directories
I want to search the file existance of current directory


A = HARDWORK B = LUCK/FATE If C=(A+B) then C=SUCCESSFUL IN LIFE else C=FAILURE IN LIFE
SCJP 1.4
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41092
    
  44
If the name of the file is "xyz.txt", then "ls xyz.txt" will list it if it is in the current directory (and not if it is in a sub-directory). Is that what you want to do?


Ping & DNS - my free Android networking tools app
saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
Originally posted by Ulf Dittmer:
If the name of the file is "xyz.txt", then "ls xyz.txt" will list it if it is in the current directory (and not if it is in a sub-directory). Is that what you want to do?


no

now i am workin in one directory and now i want to search some x directory which is palced in current directory.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41092
    
  44
Something like
?

I guess I'm unclear what you mean by "search". Are you looking for a file, or do you want to find some content in the file, or ... ?
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11404
    
  81

Have you looked at the -maxdepth option?

I recommend looking at the man page for find - a lot of your questions will be answered that way.

Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
 
wood burning stoves
 
subject: Find with out recursive
 
Similar Threads
Updating a jar
File Input/Output
Upgrading Struts 1.2 to 1.3 and Global Forward
which java I need ?
Doubt abt Socket