Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
EJB 3 in Action
this week in the
EJB and other Java EE Technologies
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
commenting a gif
After deploying page doesn't change
Pathname Validation - Please help out!!!
file upload in servlet
Check if File is Folder
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014