File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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: 42950
    
  70
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?
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: 42950
    
  70
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: 11526
    
100

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Find with out recursive