code: private static void updateDirecotryDigest(final String path, final File file, MessageDigest md) throws Exception {
  		String relativePath = file.getCanonicalPath().substring(path.length());
  		relativePath = relativePath.replace('\\', '/');		// normalizacja ścieżki
  		if(file.isDirectory()) {
  			md.update(relativePath.getBytes(Charset.forName("UTF8")));
  			if(logger.isLoggable(LOG_LEVEL)) {
  				countDigest(md.getAlgorithm(), new PathNameInputStream(relativePath));
  			}
  
  			final File[] content = file.listFiles();
  			Arrays.sort(content, new Comparator<File>() {
  				@Override
  				public int compare(File f1, File f2) {
  					return f1.getName().compareTo(f2.getName());
  				}
  			});
  
  			for(File subFile : content) {
  				updateDirecotryDigest(path, subFile, md);
  			}
  		} else {
  			md.update(relativePath.getBytes(Charset.forName("UTF8")));
  			if(logger.isLoggable(LOG_LEVEL)) {
  				countDigest(md.getAlgorithm(), new PathNameInputStream(relativePath));
  			}
  
  			updateDigest(md, new FileInputStream(file));
  			if(logger.isLoggable(LOG_LEVEL)) {
  				countDigest(md.getAlgorithm(), new FileNameInputStream(file, relativePath));
  			}
  		}
  	}
docs: --------------------------------------------------------------------------