File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Differentiate between file and a folder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Differentiate between file and a folder" Watch "Differentiate between file and a folder" New topic
Author

Differentiate between file and a folder

a gandhi
Greenhorn

Joined: Jan 19, 2004
Posts: 5
Hi,
I am getting all the files from a folder. A folder can have files and subfolders also. I want to know if there is a way in java to differentiate between a folder and a file.
Thanks...
Don Kiddick
Ranch Hand

Joined: Dec 12, 2002
Posts: 580
myFile.isDirectory()
The APi is my friend.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
The File class has an isDirectory() method which should be what you want.


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Differentiate between file and a folder