Copy file by path and paste in multiple predetermined folders

Hello all,
I have just begun using Uipath
I need to copy a file from a given path and paste it in several folders at once. The copy activity has this destination path option but that requires the path to include the file name too (which keeps changing for different files). I have not yet come up with any effective ideas to do so.

The things that I have tried:

  1. Get file name by directory.getfiles() and store them in an array/list/ collection but that shows some kind of string error
  2. Strings cant be stored in a 1d string array, so I cant make an array and be done like normal computer programs
  3. No inbuilt paste into folder activity
  4. Putting “path*.*” As destination doesn’t work

Please advise me on what can be done for this
Thanks in advance.

2 Likes

HI @subhro97

Welcome to the community!!! :slight_smile:

I have worked on a sample workflow for you. This gets the list of files in a particular folder using Drectory.GetFiles. Then loops through each file and copies it to two different folders which I have created. I guess this is what you are looking for…

CopyFiles.xaml (7.4 KB)

Let know how it goes…
If this works for you, please mark the answer as the solution so anyone with a similar problem can directly find what they need :slight_smile:

5 Likes

Fernando’s workflow is a great example. For your 4th point, you can store your destination paths in an array of strings, then using a For Each you loop through them and in Copy File activity, your destination folder should be "path" + item(from the array of destination folders) + FileName.

1 Like

Hey! Thank you for your response. I will definitely try your solution. The problem that im facing is that I cant store strings in string arrays. Is there any workaround for this ?

1 Like

Hi Fernando ! Thanks a lot for your reply. I got a new perspective on how to solve my problem. Let me try this out. Will let you know if it works !!!

1 Like

@Lahiru.Fernando Your solution works ! Thank You :smiley:

1 Like

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