Script - Renombrado recursivo de caracteres
Renombra un carácter en todas las carpetas o documentos a partir de una ruta inicial.
// Recursive renaming & to -import com.openkm.api.*;import com.openkm.bean.*;
void findNodePathHelper(String path) { for (Folder fld : OKMFolder.getInstance().getChilds(null,path)) { // print(fld.getPath().substring(fld.getPath().lastIndexOf("/")).replaceAll("&", "-")); if (fld.getPath().contains("&")) { String newName = fld.getPath().substring(fld.getPath().lastIndexOf("/")).replaceAll("&", "-"); OKMFolder.getInstance().rename(null, fld.getPath(), newName); } for (Document doc : OKMDocument.getInstance().getChilds(null, fld.getPath())) { // print(doc.getPath().substring(doc.getPath().lastIndexOf("/")).replaceAll("&", "-")); if (doc.getPath().contains("&")) { String newName = doc.getPath().substring(doc.getPath().lastIndexOf("/")).replaceAll("&", "-"); OKMDocument.getInstance().rename(null, doc.getPath(), newName); } } findNodePathHelper(fld.getPath()); }}
findNodePathHelper("/okm:root");