Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var pageSize = 100; // no more than 1000!!!
var currentPage = 0;
var currentPageSize = -1;
//var q = 'TYPE:"cm:folder" AND cm:created:[MIN TO MAX]';
var q = 'TYPE:"cm:content" AND cm:created:[MIN TO MAX]';
var sort1 = { column: 'cm:created', ascending: true };
var paging = { maxItems: pageSize, skipCount: 0 };
var def = { query: q, store: 'archive://SpacesStore', language: 'fts-alfresco', sort: [sort1], page: paging };
var i = 0;
while (currentPageSize != 0) {
paging.skipCount = currentPage * pageSize; currentPage++;
var array = search.query(def);
currentPageSize = (null != array ? array.length : 0);
if (currentPageSize > 0) {
array.forEach(function(node) {
i++;
//logger.warn(i + " - " + node.name + " - " + node.properties["sys:archivedDate"]);
node.remove();
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.