title: How to merge two Folder files into one in Java
body: <p>I am trying to create a simple function which copies or merge two or more folder files into one single folder.</p>
  
  <p>I started with below. I thought to post here to get a better quality code.</p>
  
  <pre><code>public  void copyDifferentFolderFilesIntoOne(String mergedFolderStr,String ... foldersStr)
  {
    File mergedFolder= new File(mergedFolderStr);
    for(String folder: foldersStr)
    {
      //copy folder's files into mergedFolder
    }
  }
  </code></pre>
  
  <p>When there is a conflict in file copying (i.e. file with same name exists on two or more folder) I want the file with latest timestamp get copied in mergedFolder.</p>
  
  <p>Do you know the best way to merge two or more folders files into one?</p>
  
  <p>Let me know if question is not clear.</p>