public static void copy(File src,File dst) throws IOException {
  if (src.isDirectory()) {
    ensureDirectoryExists(dst);
    String[] filesList=src.list();
    for (    String file : filesList) {
      File srcFile=new File(src,file);
      File destFile=new File(dst,file);
      copy(srcFile,destFile);
    }
  }
 else {
    copyFile(src,dst);
  }
}

public static void copy ( File src , File dst ) throws IOException { if ( src . isDirectory ( ) ) { ensureDirectoryExists ( dst ) ; String [ ] filesList = src . list ( ) ; for ( String file : filesList ) { File srcFile = new File ( src , file ) ; File destFile = new File ( dst , file ) ; copy ( srcFile , destFile ) ; } } else { copyFile ( src , dst ) ; } }
copy file object from one place to another . can be used to copy file to file , or folder to folder .
