Search code examples
javapathmovetransfer

Java eclipse Path file executable


I am trying to make an exe that will move a file from one folder to another automatically.I am having a hard time trying to write the code the grabs the file from my desired location. Here is the code that I have so far.

public class Transfer {
     Path source = C:\Users\Name\Google Drive;
             Path newdir = C:\Users\Name\Desktop;
             Files.move(source, newdir.resolve(source.getFileName()), REPLACE_EXISTING);
}

Solution

  • You can try mkyong.com solution on file manipulation:http://www.mkyong.com/java/how-to-move-file-to-another-directory-in-java/