Move documents from very large folder

cancel
Showing results for 
Search instead for 
Did you mean: 
fedorow
Senior Member II

Move documents from very large folder

Jump to solution

Hi!

I've got a folder with tens of thousands of documents. Share doesn't show the content of this folder. Node browser can't show a list of children. It must be reorganised to make the folder useful. I'm looking for a way to get the children nodes of the folder on purpose to move them to the proper location. I tried javascript, CMIS, REST API. All ways have the same problem - timeout. Sometimes I can catch several children by javascript and move it. But it is not a stable solution.

Which function/method/request can get one or several children without reading the whole children map?

1 Solution

Accepted Solutions
fedorow
Senior Member II

Re: Move documents from very large folder

Jump to solution

The search query give me any quontity of children I want.

If longFolder is a node of my folder, next query give quick answer:

var query = "PATH:'" + longFolder.qnamePath + "/*' AND PARENT:'" + longFolder.nodeRef + "' AND TYPE:'cm:content'";
var searchQuery =	
{
	query: query,
	language: "fts-alfresco",
	page: {maxItems: 100}
};
var pack = search.query(searchQuery);

for each (var doc in pack){
	logger.log(doc.name + " \t" + doc.parent.id);
//move doc to new place
... }

Required quantity of nodes is given in maxItems.

Only one thing, after moving/organise documents, search need some time to find propper pack again. So I check parent relation every time before move.

 

View solution in original post

3 Replies
angelborroy
Alfresco Employee

Re: Move documents from very large folder

Jump to solution

I guess you can find some pattern (based in the filename, date of modification...) so you can create a filter and get only a subset of files on every step inside a loop.

Hyland Developer Evangelist
fedorow
Senior Member II

Re: Move documents from very large folder

Jump to solution

So the answer is - there is no way to get the short part of a long children map.

Thanks, you saved my time! Smiley Happy

Will be digging from the documents properties side.

fedorow
Senior Member II

Re: Move documents from very large folder

Jump to solution

The search query give me any quontity of children I want.

If longFolder is a node of my folder, next query give quick answer:

var query = "PATH:'" + longFolder.qnamePath + "/*' AND PARENT:'" + longFolder.nodeRef + "' AND TYPE:'cm:content'";
var searchQuery =	
{
	query: query,
	language: "fts-alfresco",
	page: {maxItems: 100}
};
var pack = search.query(searchQuery);

for each (var doc in pack){
	logger.log(doc.name + " \t" + doc.parent.id);
//move doc to new place
... }

Required quantity of nodes is given in maxItems.

Only one thing, after moving/organise documents, search need some time to find propper pack again. So I check parent relation every time before move.