public static boolean isAncestor(final File ancestor, final File file, final boolean strict) {
		File parent = strict ? getParentFile(file) : file;
		while (true) {
			if (parent == null) {
				return false;
			}
			if (parent.equals(ancestor)) {
				return true;
			}
			parent = getParentFile(parent);
		}
	}
public static boolean isAncestor ( final File ancestor , final File file , final boolean strict ) { File parent = strict ? getParentFile ( file ) : file ; while ( true ) { if ( parent == null ) { return false ; } if ( parent . equals ( ancestor ) ) { return true ; } parent = getParentFile ( parent ) ; } }
Check if one {@link File} is an ancestor of second one.

@param strict if c then this method returns {@code true} if ancestor
and {@link File} are equal
@return {@code true} if ancestor is parent of {@link File}; otherwise, {@code false}