Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

FIle.delete()  RSS feed

 
Ravindran R
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use windows COPY command to copy files to a folder and delete those files using java File.delete() two days later.it is successful only sometimes.
Any reason for this.?The file is not opened or used by anyone at the time of deletion.No exception .delete() returns "false".
please advise..
 
Matt Senecal
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only thing I can think of is that you might have another object accessing the file you wish to delete.
I was having the same problem, and it turned out that an ActionListener was at fault. It had read data from the file, and the file had never been closed.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!