public String exportToDir(File dir, XWikiContext context) throws IOException, XWikiException { if (!dir.exists()) { if (!dir.mkdirs()) { Object[] args = new Object[1]; args[0] = dir.toString(); throw new XWikiException(XWikiException.MODULE_XWIKI, XWikiException.ERROR_XWIKI_MKDIR, "Error creating directory {0}", null, args); } } for (int i = 0; i < this.files.size(); i++) { DocumentInfo docinfo = this.files.get(i); XWikiDocument doc = docinfo.getDoc(); addToDir(doc, dir, this.withVersions, context); } addInfosToDir(dir, context); return ""; }