cancel
Showing results for 
Search instead for 
Did you mean: 

delete folder with 30000 files

sharik
Champ in-the-making
Champ in-the-making
Hi,

We have two folders with approx 30000 files, which we can not open and also can not delete,
has anybody any expierience with solving this kind of problem?

Is there ascript that we can run to delete this folders?

thanks in advance for the help
sharik
10 REPLIES 10

kavilash23
Champ on-the-rise
Champ on-the-rise
Hi,

You can always try to delete the folder from Alfresco Explorer rather than using Share. Alternatively if you have alfresco mapped as a CIFS drive, you can delete the folder from there as well.

rjohnson
Star Contributor
Star Contributor
I suspect you have a multitude of issues here.

In share you can only delete 50 at a time & if you try and delete the folder it will likely timeout and rollback.

Also, if you do succeed then you will end up with 30,000 items in the Trash and the same problem again.

In the assumption you only need to do this once, I can think of 3 possible solutions:-

1. Write a webscript that will find this folder, then for the first 100 child documents add sys:temporary the aspect and delete the document and then stop. Call that webscript manually from a webbrowser 300 times using some external scripting language 300 times. You may be able to delete more than 100 at a time before you run into transaction buffer size issues.
2. Write some Javavscript that will do the same and create a Quartz scheduled job that repeatedly calls it.
3. Write a Java Bean that will do the above but controll the transaction in the bean so you need to run it only once.

For a one off, 1 is probably easier. If you do not add sys:temporary then your 30,000 items will end up in the trash and you then have a problem deleting them from the trash (unless you are already running a trashcan cleaner).

Hi Sir ,

I am not a developer and I am just a newbie, could you help us or give us a sample script we can follow to solve this (step by step)? and how and where can we insert or add the webscript so we can use it.

Thank you very much.

brianmark2
Champ on-the-rise
Champ on-the-rise

Hi Sir Sharik _‌,

I also have same problem. Did you have a solution for this? Can you share us the solution?

Thank you

You can also use a CMIS approach like this https://github.com/keensoft/MassiveDelete

Hyland Developer Evangelist

Thank you Sir I will try it today.

Sir may I ask where will I add or insert the folder MassiveDelete-master? Can you tell us the path?

Thank you

Hi Angel thanks for your help, but if possible could you help me in a question a little more complex:

How cam I modify your suggestion for delete nodes based on a custom property, ex: delete nodes with a when  property "xyz:cam_delete" is true - or how would sql query to get nodes by the value of any custom property.

Many thanks.

angelborroy
Community Manager Community Manager
Community Manager

Probably this blog post could help you:

https://angelborroy.wordpress.com/2018/05/30/alfresco-counting-more-than-1000-elements/

Hyland Developer Evangelist