How do I copy several .xlsx files from one folder to another?

Hey Guys,

my goal is to copy .xlsx multiple .xlsx files from one to another folder. So for I tried the “For each file in a folder” snippet but it will result in the error message that the destination “…is a directory, not a file”.
But I mean this is the whole point, I want to copy all of them and not just one by one.

Would be grateful for help and advice!

1 Like

Hi @Sebastian_Linn
Welcome to UiPath Community!

  1. Assign arrFiles = Directory.GetFiles(“directoryName”, “*.xlsx”)
  2. Download this component:
  3. It is a workflow file. Invoke it. Populate the In arguments
    a. in_FileList = arrFiles
    b. in_DestinationFolder = Full path of the destination folder

Then you’re good to go :slight_smile:
Thanks and best of luck!


Hey Jan,

Thanks for your fast reply!
Isn’t that workflow just moving the files from one folder to another? In the end I basically need to have the files copied into an already existinting second folder.


1 Like

Oh yeah. I misread it.
You want to copy the files. Okay :slight_smile:
Inside the workflow file you downloaded, please find the Move File activity.

Delete it. Replace it with Copy File activity.
The Path inside the Copy File activity is file.ToString and the Destination is strNewFilePath

Give it a try, @Sebastian_Linn. Thanks! :slight_smile: