• Post Reply Bookmark Topic Watch Topic
  • New Topic

Wierd file overwrite problem.

 
v ray
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I seem to have run into a wierd problem. My code is as follows:



Now, for a given type, say images, the foldername will be "Images". The problem I am facing with this code is that only the last file/image remains after having 10 iterations. ie, the first 9 which were output are all deleted and replaced by the last copy of the file..

How do I stop the previous image from getting deleted??

Please help!
Thanks.
 
v ray
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it a problem with this line:

File folder = new File(folderPath);

ie, although the folder named "Images" already exists, I am trying to create it again?
If this is the problem, what would be the solution to the problem? Because I need to check/create the right folder name for every result based on its type.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24213
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect that the liberal application of println() statements would be very illuminating. Try printing "filePath" each time through the loop.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!