0

I'm writing a Java program which automatically takes all the files in an origin folder and organizes them into other folders based on their file type (word doc, excel spreadsheet, mp4, etc). The program is working great when I put files in the origin folder and run the program manually. How can automate this process so that the Java program runs automatically, without a person running the program manually, whenever a new file is put in the origin folder? Here's my driver:

public class DriverTest {

public static void main(String[] args) {
     FileMover test = new FileMover("C:\\Users\\intern\\Desktop\\Origin");
     test.printAll();
     test.moveAll();


}
}

I just need this to run whenever a file is put in the origin folder

Charan B
  • 1
  • 2

1 Answers1

0

You will need to schedule the task of moving the files. You can use EJB timer service to do so. See JavaCodeGeeks EJB timer service tutorial or Dzone's web interface controlled timer service example.

cdaiga
  • 4,861
  • 3
  • 22
  • 42