Hi we are using Alfresco version 3.4 .
We need details of every file and folder recursively inside a particular node folder using alfreco script.
We try with "childrenByXPath ()", "savedsearch()" and also with "luceneSearch()" in alfresco 3.4 script
but did not get correct result.
one more thing when we try with "cmis:document" query we get wrong output.
please suggest on the same
If cmis or searchQueries won't help, you could recursively scan your folder/file structure. But this is time and memory consuming.
Just store the script in Data Dictionary/scripts and execute it on the directory you want to scan through (with alfresco explorer) and change the line in with the push to fileList according to your needs.
I would not recommend this, but you said your other efforts were in vain.
//This script iterates the current folder and subfolders
//and creates a simple directory list with full pathnames.
var fileList=[];
if(document.isContainer) {
visit(document);
logfile = userhome.createFile("fileList " + document.name + " " + document.parent.children.length + ".txt");
logfile.content=fileList.join("\n");
logfile.properties.encoding = "UTF-8";
logfile.properties.mimetype = "text/plain";
logfile.properties.title = "fileList";
logfile.properties.description = "list of files in "+document.name;
logfile.save();
}
function visit(node) {
for each (var n in node.children) {
if (n.isDocument) {
//here push all infos for documents to the fileList
fileList.push(n.displayPath.slice(14) + "/" + n.name + "\t");
}
}
for each (var n in node.children) {
if(n.isContainer) {
//here you could push the folder-infos to the fileList
visit(n);
}
}
}
Discussions, help and advice about the Alfresco Development Framework.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.