Skip to content

Instantly share code, notes, and snippets.

@douglascrp
Last active December 10, 2018 16:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save douglascrp/dd6a10a61e82c6bf8ced156d419921ed to your computer and use it in GitHub Desktop.
Save douglascrp/dd6a10a61e82c6bf8ced156d419921ed to your computer and use it in GitHub Desktop.
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