Last active
December 10, 2018 16:30
-
-
Save douglascrp/dd6a10a61e82c6bf8ced156d419921ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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