@Override
  public boolean move(Versionable currentVersion, VFSContainer container) {
    VFSLeaf currentFile = (VFSLeaf) currentVersion;
    VFSLeaf fVersions = getCanonicalVersionXmlFile(currentFile, true);
    Versions versions = readVersions(currentFile, fVersions);

    VFSContainer versionContainer = getCanonicalVersionFolder(container, true);

    boolean allOk = VFSConstants.YES.equals(versionContainer.copyFrom(fVersions));
    for (VFSRevision revision : versions.getRevisions()) {
      RevisionFileImpl revisionImpl = (RevisionFileImpl) revision;
      VFSLeaf revisionFile = revisionImpl.getFile();
      if (revisionFile != null) {
        allOk &= VFSConstants.YES.equals(versionContainer.copyFrom(revisionFile));
      }
    }

    allOk &= VFSConstants.YES.equals(fVersions.delete());
    for (VFSRevision revision : versions.getRevisions()) {
      VFSLeaf revisionFile = ((RevisionFileImpl) revision).getFile();
      if (revisionFile != null) {
        allOk &= VFSConstants.YES.equals(revisionFile.delete());
      }
    }
    return allOk;
  }
  public FeedFileResource(File root, File resourceFolder, String type) {
    super.setTypeName(type);
    // After unziping the uploaded folder, I would like to copy it to the
    // appropriate location right away (and not on the next read). So, I put the
    // code here. Note that this constructor is also called on copying a
    // resource. We know that the resource folder is valid.

    // Let's now copy the resource folder to the root folder.
    VFSContainer rootContainer = new LocalFolderImpl(root);
    String folderName = FeedManager.getInstance().getFeedKind(this);
    if (rootContainer.resolve(folderName) == null) {
      // If the podcast directory doesn't exist yet, create it and copy content
      // from uploaded folder
      rootContainer = rootContainer.createChildContainer(folderName);
      VFSContainer resourceContainer = new LocalFolderImpl(resourceFolder);
      for (VFSItem item : resourceContainer.getItems()) {
        rootContainer.copyFrom(item);
        // Delete the item if it is located in the _unzipped_ dir.
        // Remember that the resource folder could be a valid folder of a
        // different resource (when copying the resource).
        if (resourceContainer.getName().equals(FileResourceManager.ZIPDIR)) {
          item.delete();
        }
      }
    }
  }
  /**
   * @see org.olat.course.nodes.GenericCourseNode#archiveNodeData(java.util.Locale,
   *     org.olat.course.ICourse, java.io.File, java.lang.String)
   */
  @Override
  public boolean archiveNodeData(
      final Locale locale, final ICourse course, final File exportDirectory, final String charset) {
    final String repoRef = (String) this.getModuleConfiguration().get("reporef");
    final OLATResourceable ores =
        RepositoryManager.getInstance()
            .lookupRepositoryEntryBySoftkey(repoRef, true)
            .getOlatResource();

    if (WikiManager.getInstance().getOrLoadWiki(ores).getAllPagesWithContent().size() > 0) {
      // OK, there is somthing to archive
      final VFSContainer exportContainer = new LocalFolderImpl(exportDirectory);
      VFSContainer wikiExportContainer =
          (VFSContainer) exportContainer.resolve(WikiManager.WIKI_RESOURCE_FOLDER_NAME);
      if (wikiExportContainer == null) {
        wikiExportContainer =
            exportContainer.createChildContainer(WikiManager.WIKI_RESOURCE_FOLDER_NAME);
      }
      final String exportDirName =
          getShortTitle()
              + "_"
              + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis()));
      final VFSContainer destination = wikiExportContainer.createChildContainer(exportDirName);
      if (destination == null) {
        Tracing.logError(
            "archiveNodeData: Could not create destination directory: wikiExportContainer="
                + wikiExportContainer
                + ", exportDirName="
                + exportDirName,
            getClass());
      }

      final VFSContainer container =
          WikiManager.getInstance().getWikiContainer(ores, WikiManager.WIKI_RESOURCE_FOLDER_NAME);
      if (container
          != null) { // the container could be null if the wiki is an old empty one - so nothing to
                     // archive
        final VFSContainer parent = container.getParentContainer();
        final VFSLeaf wikiZip = WikiToZipUtils.getWikiAsZip(parent);
        destination.copyFrom(wikiZip);
      }
      return true;
    }
    // empty wiki, no need to archive
    return false;
  }