• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Wierd file overwrite problem.

 
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic