Copy files with different names

Hello everyone,

I have issues automating the following Process:

We Import XML files into database and convert them to csv files. The csv-files are exported to a specific Folder. The Robot is supposed to copy These files and paste them to a new Folder. However, the Name of the files vary. They start with "Export_file_"timestamp(.csv). How can I create a Robot that copies csv-files that start with “Export_file_” to a new Folder?

Kind regards

Lena

1 Like

Buddy @LFien
you can use use copy file activity buddy @LFien
with the file you have now and its folder as a source and
the file with name you want to save as a destination buddy
like this
in source you have filenamed like
Export_file_12_30_AM.csv or
Export_file_12_03_2019.csv

Then in destination be like
“Export_file_”+now.ToString(“hh_mm_ss_tt”)+“.csv”
where the counter is the integer variable with default value of 1
like this buddy

image

Did that work buddy @LFien

Thank you for your reply! The filename in the source does also vary due to timestamps. Can I use the same expression as suggested for destination?

Kind regards

1 Like

Buddy @LFien

Fine in that case use like this buddy @LFien


where put the folder name and file name like this buddy along the assign activty
out_file_path = Directory.EnumerateFiles(“yourfolderpath”,“Export_file_*.csv”,searchoption.AllDirectories)

where out_file_path is of type
System.Collections.Generic.IEnumerble

in the move file activity pass the item from for each loop with type argument as string, to the From path and mention the folder path where you wan to paste in the To Part

Cheers @LFien
This would work for sure

Thank you so much, I just tried it out and it works perfectly fine!

1 Like

Thats great buddy @LFien
Kindly close this topic with the right comment marked as solution that could help others looking for ideas under your topic buddy

Cheers @LFien

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