How to get files from all duplicates folder name and then store al files in a new foder with the same name

i have multiple folder with crn numbers each of the crn numbers contains some files

what i want is to get all the duplicates crn folder

for eg folder name “3211_datetime” now there are 5 folders that contain the string “3211” in there name , i want to get all the files from all the duplicate crn and store it in one crn number for eg , 3211_10:2:00,3211_12:11:11,3211_13:13:11

take the underscore as a separator for the crn number and the date or time

now after getting each files from the duplicates crn folder create a new folder with the same crn number for eg “3211” and store all the files in that ne folder

@sagar.raval

Please follow the steps

  1. Use create folder and create a folder 3211
  2. Use for each folder in folder activity and use filter a filter "3211*"
  3. Use for each file in folder on currentfolder.fullname and move file inside it

cheers

its static with the crn number but how will i make dynamic and where is it checking for duplicates?, and one more thin in my enviorment im nable to get the for each folder in folder and file in folder activity i can only use foreach

@sagar.raval

you can use variable in place of 3211…you can have whole of this inside a loop for each crn you have…

your for each folder in folder will get each folder starting with 3211 or the crn …so if there are duplicates it would loop through those folders as well

If you dont have those activities then use directory.GetDirectories("Folderpath","3211*") and directory.Getfiles(currentfolder)

Both of the above expressions will give you array of strings/paths…use for each activity adn change typ argument to string and use these expressions in the in argument

cheers

cheers

1 Like

there is an error i directory.Getfiles(currentFolder.FullName) , "FullName is not a parameter o string

@sagar.raval

My bad if you are using forloop then you dont need .Fullname…you can directly use currentitem

cheers

1 Like

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