Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6469152

File.copyTo(File) to simply copy a file to specified directory

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P5 P5
    • None
    • 6
    • core-libs
    • x86
    • windows_xp

      A DESCRIPTION OF THE REQUEST :
      It would be incredibly nice to have a copyTo feature added to the File (Java.io.File) class that function like this:

      File file = new File("the directory");
      File fileDest = new File("the destination directory");
      file.copyTo(fileDest);

      That would be very very good for all of us developers

      JUSTIFICATION :
      it would drastically shorten code lengths and also make the programming process much better

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      make a copy of the selected file and paste it in the specified directory
      ACTUAL -
      see above^

      ---------- BEGIN SOURCE ----------
      import java.io.File;

      try
      {
            File file = new File("the directory");
            File fileDest = new File("the destination directory");
            file.copyTo(fileDest);
         }
      catch(Exception e)
         {
            System.err.println("Error!");
         }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      write a really long unneccessary code i guess....

            alanb Alan Bateman
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: