Tuesday, August 31, 2010

Article | How To Move A FIle in Java

A simple code for To Move A File In Java(any type of file)



  1. File file = new File("filename");

  2. // Destination directory

  3. File dir = new File("directoryname");

  4. // Move file to new directory

  5. boolean success = file.renameTo(new File(dir, file.getName()));

  6. if (!success) {

  7. System.out.print("\n Error");//No such a file or directory

  8. }

Loading...

Comments :

0 comments to “ How To Move A FIle in Java ”

Top Views

BloggerTipsTemplates

CHICKLETS

Enter your email address:

Delivered by FeedBurner

Followers