public long getDirectoryCount() {
    long directoryCount = 0;

    if (fileType == FileType.Directory) {
      directoryCount++;

      for (int i = 0; i < childs.size(); ++i) {
        UDFImageBuilderFile childUDFImageBuilderFile = childs.get(i);
        if (childUDFImageBuilderFile.getFileType() == FileType.Directory) {
          directoryCount += childUDFImageBuilderFile.getDirectoryCount();
        }
      }
    }

    return directoryCount;
  }
  public void addChild(UDFImageBuilderFile childUDFImageBuilderFile) throws Exception {
    if (this.fileType != FileType.Directory) {
      throw new Exception("error: trying to add child file to non-directory file");
    }

    if (this.getChild(childUDFImageBuilderFile.identifier) != null) {
      throw new Exception("error: trying to add child file with an already existing identifer");
    }

    if (childUDFImageBuilderFile.getFileType() == UDFImageBuilderFile.FileType.Directory) {
      FileLinkCount++;
    }

    childUDFImageBuilderFile.setParent(this);

    childs.add(childUDFImageBuilderFile);
  }
  public long getFileCount() {
    long fileCount = 0;

    if (fileType == FileType.Directory) {
      for (int i = 0; i < childs.size(); ++i) {
        UDFImageBuilderFile childUDFImageBuilderFile = childs.get(i);
        if (childUDFImageBuilderFile.getFileType() == FileType.Directory) {
          fileCount += childUDFImageBuilderFile.getFileCount();
        } else if (childUDFImageBuilderFile.getFileType() == FileType.File) {
          fileCount++;
        }
      }
    } else if (fileType == FileType.File) {
      fileCount = 1;
    }

    return fileCount;
  }