How to rename file by using mapping file

please see the zip file, first we have to match with mapping file then replace the csv
we have to match file name and replace with prefix than rename the file

Rename File based on the first 5 character of excel. Mapping file available at location C:// Revenue Files.

Append 3 characters in the existing file name.

Eg. File name is VMA01_2019-08-27, The new files will be MAN_VMA01_2019-08-27Assessment (3).zip (59.7 KB)

Not to be mean, but this seems like a test or assessment of some sort…
Usually, I would post the solution XAML here, but in this case, I’ll just explain one way to do this.

  1. Convert the CSV into a dictionary (Step 1 read it to create a data table, Step 2 initialize a Dictionary Step 3 use a For Each Row Activity, to add every row of the data table to the dictionary, using the Invoke Method Activity, with the Add function)

  2. Use “For Each” ad get al all items in the Directory, that has the items you want to rename

  3. Inside the for each first figure out the name of the File, Get the first 5 letters and then use the “Move File” activity to move the file and rename it to Dictionary(first5Letters) + nameOfFile

There, that should be enough. Works perfectly for me :slight_smile:
There are other ways of doing it but I think this one with the dictionary is pretty clean.

Feel free to ask any questions if you need more help or post your progress on here :wink:

Good luck!

1 Like

please help me to make a perfect xmal. for my project

He posted step-by-step instructions that were fairly detailed and even included a screenshot. Which part specifically are you having trouble with?

We are more than happy to help, but the forum is here to help you learn on your own - not perform all the work for you

Main.xaml (21.1 KB)

Hi everyone this is my xmal, I am new in automation that’s why asking so many ques,
I m not able to match which mapping file with csv,
because in mapping file two column are thier first name and prefix first we have to match with csv with first name then replace csv with prefix.

As you Know I am new in Automation, This task I search from youtube channel to learn touch task, I am also try to solve it but have lots of problem

This is my new xmal please see it and tell me the solutionMain.xaml (23.9 KB)

no one replies here