• Post Reply Bookmark Topic Watch Topic
  • New Topic

help with file deletion...

 
karan, chopra
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i have a servlet which writes something to a text file(say filename.txt).i want that whenever the servlet is executed again then it should delete the already existing filename.txt and create a new one.how can this be done..please help..its urgent..(i tried File.delete() but it throws some weird exception and doesnt let me delete the file)...
PS-can file deletion be done from an applet?
thanks a ton
regards
karan
 
Jonathan W. Brett
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why delete it? It should overwrite the file anyways. But after saying that, delete() should work. It works for me . .. .
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!