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

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

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P5
    • Resolution: Duplicate
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      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....

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: