This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Check whether Direcotry Exist..  RSS feed

 
MIRANGA_H
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi..

im creating sub-directories in side a direcotry and i wanna chack whether a sub-directory with the same name already exists before creating a new one cos otherwise it will overide it... please help if u can !!!
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In java.io.File, there is a method exists()
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may want to use File's isDirectory() method instead, which checks that the directory exists, and is really a directory rather than a regular file.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!