Copy all files from one folder to another

Hello all,

I’ve tried to search this but I can’t find a straight forward answer. I actually think I am close, but keep getting an error.
I am trying to copy all files from one folder to another (ok to overwrite if that is what is easiest), but I can only find instructions to copy one at a time.

I have a For Each and then a Copy File action, but there is something wrong with the process.


The value in the For Each is " directory.GetFiles("\xxx \FY " + xxx + “\Daily ESS”) "

When I use the file name in Copy File action, it works well in isolation, so I know the file path works.
image

The error I keep getting in the exception is “RemoteException wrapping System.IO.IOException: The filename, directory name, or volume label syntax is incorrect.”

Any help would be appreciated.

Thanks in advance,
Stephen

1 Like

Please check your destination path (either foldername or filename). It should not contain characters like \ , / , : , * , " , < , >, |

Hello Emman,

Thanks for getting back to me so quickly.
I’ve run the file name and path through a single Copy File and it works.


When added to the For Each, it errors.
The only difference is that I use the whole file path is ESS 2019.09.01.csv which I do not use on the For Each. Also the directory.GetFiles is added to the From path.

Thanks,
Stephen

Further to this, the directory.GetFiles seems to be correct as the process passes it.
It fails here:
image

This is the details on this action:
image

Thanks,
Stephen

For debugging purposes, you can replace copy file to write line your destination file path and make sure it doesnt contain unallowed characters for a filename or file path.

UPDATE:
As I check the screenshot, seems you are just specifying the Folder path in the destination. You should specify the fullpath including the file name in the To Destination parameter.

You can try to add this in your destination param:

"your destination file path"+Path.GetFileName(item)

1 Like

That is exactly it!!! Thats so much. I tried adding just “item”, but needed the Path.GetFileName action as well.
image

Thanks again!
Stephen

1 Like

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