public static boolean filesExistOnDestButNotSrc(Configuration conf,Path src,Path dest,Optional<PathFilter> filter) throws IOException {
  Set<FileStatus> srcFileStatuses=getFileStatusesRecursive(conf,src,filter);
  Set<FileStatus> destFileStatuses=getFileStatusesRecursive(conf,dest,filter);
  Map<String,Long> srcFileSizes=null;
  Map<String,Long> destFileSizes=null;
  try {
    srcFileSizes=getRelPathToSizes(src,srcFileStatuses);
    destFileSizes=getRelPathToSizes(dest,destFileStatuses);
  }
 catch (  ArgumentException e) {
    throw new IOException("Invalid file statuses!",e);
  }
  for (  String file : destFileSizes.keySet()) {
    if (!srcFileSizes.containsKey(file)) {
      LOG.warn(String.format("%s exists on %s but not in %s",file,dest,src));
      return true;
    }
  }
  return false;
}

public static boolean filesExistOnDestButNotSrc ( Configuration conf , Path src , Path dest , Optional < PathFilter > filter ) throws IOException { Set < FileStatus > srcFileStatuses = getFileStatusesRecursive ( conf , src , filter ) ; Set < FileStatus > destFileStatuses = getFileStatusesRecursive ( conf , dest , filter ) ; Map < String , Long > srcFileSizes = null ; Map < String , Long > destFileSizes = null ; try { srcFileSizes = getRelPathToSizes ( src , srcFileStatuses ) ; destFileSizes = getRelPathToSizes ( dest , destFileStatuses ) ; } catch ( ArgumentException e ) { throw new IOException ( "Invalid file statuses!" , e ) ; } for ( String file : destFileSizes . keySet ( ) ) { if ( ! srcFileSizes . containsKey ( file ) ) { LOG . warn ( String . format ( "%s exists on %s but not in %s" , file , dest , src ) ) ; return true ; } } return false ; }
checks to see if filenames exist on a destination directory that don ' t exist in the source directory . mainly used for checking if a distcp - update can work .
