public static boolean directoryIsEmpty(File directory) {
		if (directory == null) {
			return true;
		}

		if (!directory.exists()) {
			return true;
		}

		if (!directory.isDirectory()) {
			return false;
		}

		File[] files = directory.listFiles();
		boolean hasFiles = files != null && files.length > 0;
		return !hasFiles;
	}
Returns true if the given file is not null, exits, is a directory and has no files.

@param directory the directory to test for emptiness
@return true if the given file is a directory and has not files.
Ghidra/Framework/Utility/src/main/java/utilities/util/FileUtilities.java