Maybe you can create a service that takes the first thousand section hits and converts them to folders, something like this:
import { connect } from '/lib/xp/node';
const repo = connect({
repoId: 'cms-repo',
branch: 'draft',
principals: ['role:system.admin']
});
exports.get = function(request) {
const sectionQuery = repo.query({
query: `type = ${app.name}:cms2xp_section`,
count: 1000 // Process in batches of 1000 to save memory load
});
if (sectionQuery.hits.length) {
const sectionIds = sectionQuery.hits.map(hit => hit.id);
const sectionContents = repo.get(...sectionIds);
sectionContents.forEach(content => {
repo.modify({
key: content._id,
editor: node => {
// Replace contentType
node.type = 'base:folder';
return node;
}
});
});
}
}
This is ES6 code and I haven’t tested this on an actual server with cms2xp content, so please test your code on safe non-production data before you run this service!