Access to path denied exception

Hi everyone, Can we copy folder from source to destination using copy file or we just copy files using it?
I tried copying folder its giving me “Access to path is denied”
System.UnauthorizedAccessException

Hi @rpajyoti_wagh

we can only copy files with that

To copy the entire folder, you can use some simple Powershell cmdlets as well for the purpose.

Regards,
Nived N

1 Like

Hi @rpajyoti_wagh
You can just copy files with ‘copy file’ activity.
But you can use ‘create folder’ and then ‘copy file’ to copy all the files in the old folder to the new one.

1 Like

Here is a sample from the forum how to use Invoke Method Activity to copy a directory.

Thanks everyone I am clear now :slightly_smiling_face:

@rpajyoti_wagh - Please check this for your reference…

to workaround the copy activity, i had to use power shell, so there is a activity called “Invoke Power Shell”.

That is the code: “& { $xcopyCommand = 'xcopy “”” + str_pathWindows + “”" “”" + str_pathSharepoint + “”" /E /I /Y’; Invoke-Expression $xcopyCommand }" on powershell UiPath activity. And it worked great.