/** * Compare 2 directories on the file system and return an object containing the results. All of the files contained in either of the 2 directories get aggregated into 5 * categories. * * <pre> * 1 - Both - Files that exist in both directories * 2 - Different - Files that exist in both directories but who's MD5 checksums do not match * 3 - Identical - Files that exist in both directories with matching MD5 checksums * 4 - Source Dir Only - Files that exist only in the source directory * 5 - Target Dir Only - Files that exist only in the target directory * </pre> * * The 5 lists in <code>DirDiff</code> contain the relative paths to files for each category. */ public static DirDiff getMD5Diff(DirRequest request) { // Do a quick diff (just figures out what files are unique to each directory vs files that are in both) DirDiff diff = getQuickDiff(request); // Do a deep diff // This computes MD5 checksums for any files present in both directories fillInMD5Results(diff); // return the diff result return diff; }
/** * Compare 2 directories on the file system and return an object containing the results. All of the files contained in either of the 2 directories get placed into one of 3 * categories. * * <pre> * 1 - Both - Files that exist in both directories * 2 - Dir 1 Only - Files that exist only in directory 1 * 3 - Dir 2 Only - Files that exist only in directory 2 * </pre> * * The 3 lists in <code>DirectoryDiff</code> contain the relative paths to files for each category. */ @Deprecated public static DirectoryDiff getDiff(DirectoryDiffRequest request) { DirRequest newRequest = new DirRequest(); newRequest.setExcludes(request.getExcludes()); newRequest.setIncludes(request.getIncludes()); newRequest.setSourceDir(request.getDir1()); newRequest.setTargetDir(request.getDir2()); DirDiff diff = getQuickDiff(newRequest); DirectoryDiff dd = new DirectoryDiff(diff.getSourceDir(), diff.getTargetDir()); dd.setBoth(diff.getBoth()); dd.setDir1Only(diff.getSourceDirOnly()); dd.setDir2Only(diff.getTargetDirOnly()); return dd; }