fitgoodies-core/src/main/java/de/cologneintelligence/fitgoodies/file/FileSystemDirectoryHelper.java
public boolean isSubDir(final File subDir, final File parentDir) throws IOException {
		int parentDirLength = parentDir.getCanonicalFile().getAbsolutePath().length();

		File currentDir = subDir.getCanonicalFile().getAbsoluteFile();
		while (currentDir.getAbsolutePath().length() > parentDirLength) {
			currentDir = currentDir.getParentFile();
		}

		return currentDir.equals(parentDir.getAbsoluteFile());
	}
public boolean isSubDir(final File subDir, final File parentDir) throws IOException {
		int parentDirLength = parentDir.getCanonicalFile().getAbsolutePath().length();

		File currentDir = subDir.getCanonicalFile().getAbsoluteFile();
		while (currentDir.getAbsolutePath().length() > parentDirLength) {
			currentDir = currentDir.getParentFile();
		}

		return currentDir.equals(parentDir.getAbsoluteFile());
	}
public boolean isSubDir ( final File subDir , final File parentDir ) throws IOException { int parentDirLength = parentDir . getCanonicalFile ( ) . getAbsolutePath ( ) . length ( ) ; File currentDir = subDir . getCanonicalFile ( ) . getAbsoluteFile ( ) ; while ( currentDir . getAbsolutePath ( ) . length ( ) > parentDirLength ) { currentDir = currentDir . getParentFile ( ) ; } return currentDir . equals ( parentDir . getAbsoluteFile ( ) ) ; }
Checks whether {@code subDir} is a sub directory of {@code parentDir}.
Note: the comparison is case sensitive.

@param subDir    potential sub directory
@param parentDir parent directory
@return {@code true} if {@code subDir} is a subDirectory of
{@code parentDir}, false otherwise.
@throws java.io.IOException Thrown when paths cannot be normalized.
Checks whether { @code subDir } is a sub directory of { @code parentDir } . Note : the comparison is case sensitive .