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