title: Java - Move and Rename all files from one destination to another
body: <p>I have files in one folder, i want to move them into the another folder but also and to rename them (with some static prefix value which should be added)</p>
  
  <p>I succeed to list all files from the source directory but I cannot find <code>move</code> method when getting <code>files[i]</code> and I also cannot find how to rename and move files to another folder in the same time.</p>
  
  <p>Can someone tell me what I should add in <code>getFiles</code> method in order to move and rename.</p>
  
  <p>This is my class.</p>
  
  <pre><code>import java.io.File;
  
  public class CopyTest {
  
      static File mainFolder = new File("F:\\TestCopy");
      static File destinationFolder = new File("F:\\TestCopy2");
      public String prefix="PREFIX";
  
      public static void main(String[] args)
      {
          CopyTest lf = new CopyTest();
          lf.getFiles(lf.mainFolder);
  
          long fileSize = mainFolder.length();
  
              System.out.println("File size in KB is : " + (double)fileSize/1024);
  
      }
      public void getFiles(File f){
          File files[];
          if(f.isFile())
              System.out.println(f.getAbsolutePath());
          else{
              files = f.listFiles();
              for (int i = 0; i &lt; files.length; i++) {
  
  
                  getFiles(files[i]);
  
              }
          }
      }
  }
  </code></pre>