Repeated files when using ForEachFileX activity

Hello everyone! I have a problem :frowning:
I am carrying out a workflow in which I have the “ForEachFolderX” activity and within it is the “ForEachFileX” activity, the problem occurs when going through each of the files that are in the folders, because each file is opened twice times, but in folders the files are only found once. I don’t know what could be wrong.

In advance, thank you very much for your help.

Hi @camilacalderon

Is it possible to send the workflow or show it…As that is not the behavior that I am seeing when I replicate the same scenario

Can you try printing the full locations and see if there are any sub folders containing the same files and is the include subfolders checked?

cheers

1 Like

Try getting the count of number of files in the folder and check if that count is matching the count in the folders. If the count matches, avoid opening the same file twice by getting the file name in the folder, assigning that to a string variable, put a condition to see if that file name matches the next file you are about to open.

Let us know if that worked!

1 Like

@camilacalderon

I guess Include sub folders is checked both in foreachFolderX and in foreachfileX which makes each folder traverse twice…Please uncheck Include subfolders in FOreachFolderx loop and if you need check it only in the FOrEachFileX that way each folder is traversed only once

This the case where multiple files are coming

cheers

1 Like

Yes, that was the problem. Thank you very much!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.