Invoke Code Activity showing errors

Hey Guys

I am trying to use the invoke code activity to type in the following code: Directory.Move(sourceDirectory, destinationDirectory); But it showing the following error that character is not valid.

Also not sure if I am using this activity correctly. But basically I want to pass in the arguements of sourceDirectory and destinationDirectory to the activity.

First you need to create the arguments in invoke code activity and then use it inside the code as variables @bobby

Just check this and post the error screenshot for better understanding if you still got the same error

1 Like

invokeCodeDirectoryMove.xaml (4.6 KB)

Please go to edit arguments, give source path and destination path.
Test it.

Thanks!

1 Like

Here is the documentation and example from UIPath docs.
Please refer how to use Arguments in Invoke Code Activity.

Regards,
Karthik Byggari

1 Like

@kadiravan_kalidoss I tried running the code with the source and destination. But it is giving me the following error.

Check the file paths are valid one… For me its running fine.

Thanks!

1 Like

Yeah I have checked them. Can I ask this should able me to move a folder from source to the other folder in the destination. As it works when you want to move the folder to a new folder that doesnt already exist.

Yeah, first check with getfiles and if it is working fine, then do as required. @bobby

Hi @bobby

Why dont you use move file activity

Thanks
Ashwin S

1 Like

It doesnt move folders.

Hi @bobby,

We can use Move file activity, ensure the paths are available using path exists activity. If path not found, using Create Directory activity create the folder then Move the file.

Thanks!

2 Likes

Yeah that sounds like the plan. Thanks man.

2 Likes

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