File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

create a folder from a servlet

 
Ishita Saha
Ranch Hand
Posts: 39
  • 0
  • 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
Pie
Posts: 42966
73
  • 0
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ulf,
It did work very well.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic