Create a loop to find the elements

Hello. I’m having trouble creating loops to find the location of groups in an app. Namely Ansa.
At group LV1 I want to check if it has only 1 group?

  • If there are 2 groups or more, you will move that Ansa files to another Folder (NG Folder).
  • If there is one, check the name of the group.
    For example: if the group name is “xxx_yyy_zzz” then ok. If the group name is xxx-yyy zzz, the group name will be corrected to “xxx_yyy_zzz”. The inner child groups are similar

I’ve tried each of these problems with small programs, but when I assembled them into a big program, I didn’t know how. Please help!

image
Because my computer doesn’t have Ansa installed, it’s hard for people to imagine. But I created a folder with a similar structure. I hope everyone understands :smiley:

@Akaza,

Yes, we have understood your issue. thank you detailed explanation :slight_smile:
one group means one file… right?

Please use code below,
// Store all files in string array
strArrFiles = Directory.GetFiles(“Path of files where they are located”, “*.txt”)
// Use for each to loop over them
For each file in strArrFiles {
// move your files
}Else{
// do other work
}

Hope i answered you :slight_smile:

1 Like

Thanks for answering me. I’ll try. Thank you

1 Like