file or folder already exists while creating a new folder concurrently for multiple files

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

file or folder already exists while creating a new folder concurrently for multiple files

We are making a call from CMIS API to alfresco to upload documents. Here we are having a rule to move documents from document library into different folders based on metadata. As we are uploading files in bulk, rule gets executed concurrently on multiple files. Due to this, it is trying to create the same folder multiple times. As a result, some of the files are not moving into the destined folder. On a few occasions, all the files are getting uploaded correctly and sometimes, only one or two gets uploaded correctly. If the folder already exists, it shouldn't look to create the folder again but it is trying to do so here. In logs, we see the error "File or folder already exists".

2 Replies
abhinavmishra14
Advanced

Re: file or folder already exists while creating a new folder concurrently for multiple files

You might have to use a custom rule script or behavior where you can check whether the folder you are trying to create already exists, if not then create the folder else get the nodeRef of the existing folder on intended path and move the file accordingly.

 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
Alphacharlie
Member II

Re: file or folder already exists while creating a new folder concurrently for multiple files

Thanks for your response!

We have a custom rule where we check if the folder already exists or not by using the childByNamePath() in JavaScript. If it returns null, we are creating the folder.

 

As multiple files are being uploaded using CMIS API, each node is looking to create the folder asynchronously and making a call to create a folder. For first few calls, it is taking some time to create the folder and in the mean time other nodes are trying to create the folder as well as the folder doesn't already exist. Due to this we are getting the error.