Always into the same folders, confirm this point.
For example I suggest this script, create a crontab task for it.
Code: Select allimport com.openkm.module.db.stuff.DbSessionManager;
import com.openkm.api.*;
import com.openkm.util.impexp.HTMLInfoDecorator;
import com.openkm.util.impexp.RepositoryImporter;
import com.openkm.util.impexp.ImpExpStats;
import com.openkm.util.FormatUtil;
import java.io.*;
PrintWriter out = new PrintWriter("/home/openkm/out.html", "UTF-8");
boolean metadata = false;
boolean history = false;
boolean uuid = false;
String systemToken = DbSessionManager.getInstance().getSystemToken();
File dir = new File("/home/openkm/import/folderA");
long begin = System.currentTimeMillis();
ImpExpStats stats = RepositoryImporter.importDocuments(systemToken, dir, "/okm:root/imported/folderA", metadata, history, uuid, out, new HTMLInfoDecorator(files));
long end = System.currentTimeMillis();
out.println("<hr/>");
out.println("<div class=\"ok\">Filesystem '"+new File(fsPath).getAbsolutePath()+"' imported into '"+repoPath+"'</div>");
out.println("<br/>");
out.println("<b>Documents:</b> "+stats.getDocuments()+"<br/>");
out.println("<b>Folders:</b> "+stats.getFolders()+"<br/>");
out.println("<b>Mails:</b> "+stats.getMails()+"<br/>");
out.println("<b>Size:</b> "+FormatUtil.formatSize(stats.getSize())+"<br/>");
out.println("<b>Time:</b> "+FormatUtil.formatSeconds(end - begin)+"<br/>");
// TODO
// After importing should clean folderA and folderB contents !!!
// The same with the other folder
// Also could send html contents into html with MailUtils class
However I suggest a crontab based in jar ( you will be able to debug it easily ). If you do not have OpenKM portable edtion take a look here
https://sourceforge.net/projects/openkmportabledev/
You should be interested in
repository_import.jsp file
RepositoryImporter.java class
https://wiki.openkm.com/index.php/Crontab
https://wiki.openkm.com/index.php/Cront ... e_importer ( another way to solve it )