• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

create a folder from a servlet

 
Ishita Saha
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to check whether a particular folder exists from my servlet code and if doesn't then i need to create one.

Can i do that in Java servlet?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. Are you familiar with the java.io.File class? It contains mkdir and mkdirs methods.

Note that file I/O may be forbidden by a security manager if the directories are not inside of the web applications root directory. But you'll see soon enough if that's the case; no harm in trying first.
 
Ishita Saha
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf,
It did work very well.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic