I have a workflow which will generate some MS Word documents based on a template and some predetermined conditions.
There are chances where the same file name might occur, but since the content in the Word files would be different, I don’t want to overwrite it.
In the case where the same file name occurs, instead of overwriting the previous file, I will name the second one with a number in a bracket. For example,
ThisIsOneFile_Variable1_Variable2_Variable_3.docx
ThisIsOneFile_Variable1_Variable2_Variable_3 (2).docx
ThisIsOneFile_Variable1_Variable2_Variable_3 (3).docx
ThisIsOneFile_Variable1_Variable2_Variable_3 (4).docx
and so on… depending on the occurrence of file names being the same
1.Get List of word docs from the folder
2.get the count of current file name which matches from the above list
3.Increase the count+1 and create the name to save
Thank you for your help. However, I am not sure if this could be efficient, because there could be several hundred of documents in the folder. I guess it might take quite a long time if we need to get the list and count all current file name every time before a new document is generated…