File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Checking For Directory Existance
Joined: Oct 26, 2004
Nov 12, 2004 05:41:00
Im using some code to list the contents of a directory as a
, and Im wanting to add in some fail safes.
How would I go about checking if the directory exists first of all? If it doesnt exist, I want to output a message saying it doesnt exist.
Similarly, if the directory is empty I want to ouput that too.
Joined: Oct 12, 2000
Nov 12, 2004 06:35:00
check the API docs for File. Everything you need is in there, it's only a few lines of code.
author and iconoclast
Joined: Jul 08, 2003
Nov 12, 2004 08:21:00
. See the "exists" method.
[Jess in Action]
I agree. Here's the link:
subject: Checking For Directory Existance
file upload in servlet
commenting a gif
After deploying page doesn't change
Check if File is Folder
Pathname Validation - Please help out!!!
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013