public static boolean isAncestor ( File ancestorCandidate , File file ) { String path = ancestorCandidate . getAbsolutePath ( ) ; if ( ! path . endsWith ( "/" ) ) path += "/" ; return file . getAbsolutePath ( ) . startsWith ( path ) ; }
Determines whether a directory contains a given file .