• Post Reply Bookmark Topic Watch Topic
  • New Topic

scan a new file in a directory

 
xiao liu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Glad to know this forum and like to learn Java from all the experts.
Thanks for any help in advance!
I am trying to build a process to look for any newly created files in a specific directory. If a file is created, I will pick it up and notify the UI part. I wonder if there is any Java class available for the process.
Thanks,
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Site:
Thank you for posting to JavaRanch. While we appreciate your comments on the quality of this forum, we do have a Naming Policy that your display name does not, unfortunately, meet. Please change your display name here.
Thanks
 
Joel McNary
Bartender
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as the answer to your question goes, I think that the best way to do this would be to create a separate process in a thread that monitors a directory, continually polling that directory every so often (30 seconds, 15 minutes, whatever you describe). This process would detect new files and perform whatever notifications it needs to. This is not a built-in feature to Java, although it shouldn't be to hard to create somethign like this, either.
Look at the java.io.File class for functions to do this.
[ February 24, 2004: Message edited by: Joel McNary ]
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the Threads and Synchronization forum...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!