Results 1 to 1 of 1
Thread: moving a file
-
moving a file
Following code can be used to move a file from one place to other place. After transfer, it gives a confirmation message if transfer was successful.
Java Code:// file to be moved File file = new File("File.txt"); // file to be moved to this destination File dir = new File("./directory"); // Move file to a new directory boolean success = file.renameTo(new File(dir, file.getName())); if (success) { System.out.println("File was successfully moved."); } else { System.out.println("File was not successfully moved."); }
Similar Threads
-
File fp = new File(filePath);fp.exists() does not yeild proper result
By ganeshp in forum Advanced JavaReplies: 2Last Post: 04-07-2009, 06:25 AM -
moving slider with key event
By adam405 in forum New To JavaReplies: 1Last Post: 03-18-2008, 03:50 PM -
moving image - PROBLEM
By Triss in forum New To JavaReplies: 3Last Post: 01-17-2008, 06:52 PM -
Moving icons on your desktop
By Leprechaun in forum New To JavaReplies: 3Last Post: 12-14-2007, 10:07 AM -
examples of moving objects
By fred in forum New To JavaReplies: 1Last Post: 08-07-2007, 06:06 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks