• 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

Query on File Copy.

 
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends ,
I have a requirement like this .. when ever a file is created in a directory a java program should pick it up and place it in my local folder and should be taken for further processing.
So i wrote a Java thread that listens that directory indefinitely so when ever a file is placed in it then it'll copy that file to my local directory.

The problem is since a thread is listening the directory in a while loop ( while (true ) { .... } ) , i'm getting an exception like new file cannot be created in the directory since some other process is using the directory. Is there any solution for this .

Currently what i'm doing is i'm keeping a time interval so that the thread will sleep for 15 mins and after each 15 mins interval it checks the folder for new file ..
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure how it is accomplished because I haven't looked at the code but it sounds like the hot folder concept in AntFlow, http://antflow.onionnetworks.com/download.html.
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Scott Corley:
Not sure how it is accomplished because I haven't looked at the code but it sounds like the hot folder concept in AntFlow, http://antflow.onionnetworks.com/download.html.


YEP i have sorted out the problem .. I have opened a file for reading & since there was some exception the file reader was not closed ... !!
Thanks
 
Would you like to try a free sample? Today we are featuring tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic