Merge files when files name contains same value

Hi all ! (sorry for my english, i’m french)

I need your help for my problem here :

I try to merge files in folder that have the same value inside file name. Then with this value, i create a folder if not exist. For example :

image

The value can be 2021, 2024, 2020…

Thanks a lot for your help :slight_smile:

Hi @bloog

Please look at the attached xaml

filesseggrgation.xaml (13.3 KB)

in variables pass the main folder where you have the files

cheers

Use directory.getfiles(your filepath) to get a list of the files.
Then loop through each file assigning the year within the string as a key in a dictionary of (String, String). Assign the file name (item) as your value to the key. Your dictionary should now contain:
Key’s= Years
Value’s = file names in that year

Thanks Anil_G BUT i can’t open the project with StudioX…

Hi @bloog

No Problem…This is studio. Try like these screenshots

Variables:

start

If condition in loop

Next loop

Inside the loops

Hope you can recreate in studiox

cheers

@Anil_G
Thanks a lot, i really understand your method (but the method “.combine” doesn’t exist in studioX :frowning_face:) il will try to find a solution

@grant.grisham
Thanks for your reply

2 Likes

Hi @bloog

You can directly give like this as well

mainfolderpath + “\” + currentItem or directly include a trailing \ in mainfolderpath

Please mark the solution if its resolved. It would help others to identify who needs help

cheers

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