Empty folders?

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

Empty folders?

I have some sub-folders in a folder. The sub-folders aren't needed anymore and I wanted to empty the contents into the main folder while getting rid of the sub folders.

It there a way to do this besides manually moving the contents and then deleting the subfolders?

1 Reply
abhinavmishra14
Advanced

Re: Empty folders?

You need to write a javascript/java backed webscript to move the contents to main folder and then delete the sub folders if you dont want to do it manually. There is nothing out of the box available to do this task unfortunately. 

Steps you would be doing in your script at a very high level:

1 - Find all the decendents folders within main parent folder (you can use search root scope object)

2- Store the nodeRef of the parent folder in a variable for later use.

3-  Iterate through the folders and find their decendent nodes (https://github.com/Alfresco/alfresco-community-repo/blob/master/repository/src/main/java/org/alfresc...

4- Move the nodes to parent folder using the nodeRef saved in the variable. (https://github.com/Alfresco/alfresco-community-repo/blob/master/repository/src/main/java/org/alfresc...)

5- Delete the folder (https://github.com/Alfresco/alfresco-community-repo/blob/master/repository/src/main/java/org/alfresc...)

~Abhinav
(ACSCE, AWS SAA, Azure Admin)