public static void copyPathToPath(final String fromPath,final String toPath,FileCopyProcessor fileCopyProcessor){
  File fromDirectoryFile=new File(fromPath);
  File toDirectoryFile=new File(toPath);
  String fromDirectoryPath=fromDirectoryFile.getAbsolutePath();
  String toDirectoryPath=toDirectoryFile.getAbsolutePath();
  if (fromDirectoryPath.equals(toDirectoryPath)) {
    toDirectoryPath=toDirectoryPath + "_copy";
  }
  Queue<File> queue=new ConcurrentLinkedQueue<File>();
  queue.add(fromDirectoryFile);
  while (!queue.isEmpty()) {
    File file=queue.poll();
    String fromFilePath=file.getAbsolutePath();
    String toFilePath=toDirectoryPath + fromFilePath.substring(fromDirectoryPath.length());
    if (file.isDirectory()) {
      boolean result=true;
      if (fileCopyProcessor != null) {
        result=fileCopyProcessor.copyFileToFileProcess(fromFilePath,toFilePath,false);
      }
      if (result) {
        File[] fileArray=file.listFiles();
        if (fileArray != null) {
          queue.addAll(Arrays.asList(fileArray));
        }
      }
    }
 else     if (file.isFile()) {
      if (fileCopyProcessor != null) {
        fileCopyProcessor.copyFileToFileProcess(fromFilePath,toFilePath,true);
      }
    }
  }
}

public static void copyPathToPath ( final String fromPath , final String toPath , FileCopyProcessor fileCopyProcessor ) { File fromDirectoryFile = new File ( fromPath ) ; File toDirectoryFile = new File ( toPath ) ; String fromDirectoryPath = fromDirectoryFile . getAbsolutePath ( ) ; String toDirectoryPath = toDirectoryFile . getAbsolutePath ( ) ; if ( fromDirectoryPath . equals ( toDirectoryPath ) ) { toDirectoryPath = toDirectoryPath + "_copy" ; } Queue < File > queue = new ConcurrentLinkedQueue < File > ( ) ; queue . add ( fromDirectoryFile ) ; while ( ! queue . isEmpty ( ) ) { File file = queue . poll ( ) ; String fromFilePath = file . getAbsolutePath ( ) ; String toFilePath = toDirectoryPath + fromFilePath . substring ( fromDirectoryPath . length ( ) ) ; if ( file . isDirectory ( ) ) { boolean result = true ; if ( fileCopyProcessor != null ) { result = fileCopyProcessor . copyFileToFileProcess ( fromFilePath , toFilePath , false ) ; } if ( result ) { File [ ] fileArray = file . listFiles ( ) ; if ( fileArray != null ) { queue . addAll ( Arrays . asList ( fileArray ) ) ; } } } else if ( file . isFile ( ) ) { if ( fileCopyProcessor != null ) { fileCopyProcessor . copyFileToFileProcess ( fromFilePath , toFilePath , true ) ; } } } }
copy path to path , copy process include directory copy
