Copy all files with similar names and paste it in another folder

Hello, everyone :slight_smile:
My RPA will download a new excel file every day. The file always comes with the same name pattern: fnd_gfm_ [random number].xls

So, the downloaded file will always start with the name: fnd_gfm_
I want the RPA to go to the downloads folder and copy all the files that start with fnd_gfm_ and paste it in another folder.
How can I do that?

@req7 - you can try below
get ```
ListOfFiles = Directory.GetFiles(“FromFolderPath”, “fnd_gfm_*.xls”)
do a for each loop with the ListOfFiles
inside foreach → add copy file activity
copy file activity → properties → destination path → " ToFolderPath"+Path.GetFileName(item)

1 Like

I’m sorry, I didn’t get it right.
I have to use a “List Storage Files” activity and insert Directory.GetFiles(“FromFolderPath”, “fnd_gfm_*.xls”) in the “Directory” field?

I did it. :slight_smile:
I was able to resolve this by using a part of what @GBK said, but changing some things that were not correct. Now it works perfectly.
In the string pattern, I had to use just “fnd_gfm_*” (whitout the .xls) and in the destination path, I didn’t used the +Path.GetFileName(item)
I’ll post the image here, to help others as well.

Thank again, @GBK!!

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