cancel
Showing results for 
Search instead for 
Did you mean: 

List all files in a directory with 50000+ files

neo6200
Champ in-the-making
Champ in-the-making
I would like to know how to list all files in a directory with a large amount of files.

Ive tried with a webscript like this one.

 
var node= companyhome.childByNamePath("XXX");

var nodos=node.children;
var numBonosTotal=nodos.length;



The problem is that every time i execute it, it ends with a number really different. One time is 27k, another 17k another 50k.

Is there a way to know how much files are really? and after that list them.

Any Idea?

Thankyou
1 REPLY 1

romschn
Star Collaborator
Star Collaborator
One option you can try is - run the code with system user. It should get you the correct results each time.
It looks like you are using a JavaScript based web script, in which you will not get the apis to run a particular code block with system user. You will need to create a custom JavaScript extension for that.
If you would be having a Java backed web script, you could directly use method from AuthenticationUtil to run as a
system user.

Alternatively, you can write a database query for this.

Hope this helps.