Exclude elements in for each loop

Hi guys,

I hope you are all doing fine!
I’ve got the following issue. In my “for each activity” I’d like to iterate through every folder (=ordner). So far so good everything works. But in the next step I want to define that my loop should ignore all folder that starts with a “ZZ” like “ZZ_Archiv” and so on. I tried to use an if activity. But in the end the loop doesnt ignore these folders and iterates thorugh all. Can you see where my misstake is?
Thank you very much!

Regards

Hi @marco.roensch

In the If condition give the below one,

System.IO.Path.GetDirectoryName(Ordner).Contains("Condition1") or System.IO.Path.GetDirectoryName(Ordner).Contains("Condition2")

This will check the each folder name and check the condition.

Change the Folder Names in the Condition1 and Condition2.

Hope it helps!!

1 Like

We can use a filter LINQ on the GetDirectories Return

Hi @mkankatala

Thank you! I could solve it by using Contains and rewrite the Condition (It is now more general).

Thanks 2 y’all

1 Like

It’s my pleasure… @marco.roensch

Happy Automation!!

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