• Post Reply Bookmark Topic Watch Topic
  • New Topic

file.delete works most of the time, but fails every so often  RSS feed

 
joe abernathy
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all. i'm not sure why this erratic behavior is happening. my program downloads zip files from an ftp server, unzips them to a temp directory, processes the text files in the temp dir, and then finally cleans out the temp directory. About 95% of the time, it's able to clean out the temp directory successfully, but every once in a while, it'll run into a file that it can't delete. When that happens, I have to login to windows and delete the rest of the files manually. In the program, i have a bufferedreader that's reading the contents of each text file, and I'm closing the bufferedreader every time i'm done with it. So, if it's not a problem with closing the handle to the file, what else could it be? Also, there are no other processes on this machine that are taking control of these text files; it's just my program. any help would be greatly appreciated! thanks
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chances are it's your code, but it's impossible to say since there isn't any to look at. I've never had *any* issues with deleting files through Java that weren't caused by code, another process, etc. Doesn't mean you're *not*, but I'm skeptical.
 
joe abernathy
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
after the program unzips the zip files, it goes through and parses each of the text files. Here's the parsing:

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read. You can edit your post by using the button.
 
joe abernathy
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry, my bad. code looks much better now!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!