This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes find whether the folder exists or not Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "find whether the folder exists or not" Watch "find whether the folder exists or not" New topic
Author

find whether the folder exists or not

Madhu Sudhana
Ranch Hand

Joined: Apr 16, 2006
Posts: 127
How can we find that

a floder exists or not in a particular location?

ex:

c:\folder1

I have to search folder1 exists in c:\ or not

let me know if any body has the answer??


"And the trouble is, if you don't risk anything, you risk even more." -- Erica Jong.
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
The java.io.File class has a method exists().
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 980


Try this


exists....checks whether the input exists (it can be a file or a folder)
isDirectory..checks whether the input exists and if it exists....it should be a directory...
[ October 04, 2006: Message edited by: A Kumar ]
Madhu Sudhana
Ranch Hand

Joined: Apr 16, 2006
Posts: 127
I got the answer

its simple


[ October 04, 2006: Message edited by: sudhana madhu ]
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: find whether the folder exists or not
 
It's not a secret anymore!