Move/rename file path type error

Hello,

I am working in a cross platform project. I am trying to use the Move File activity to to move and rename a downloaded pdf file.

The “From” and “To” fields are not accepting the filepath as a string but are requiring an IResource. (When I put in a string I get error: Argument ‘DestinationResource’: BC30512: Option Strict On disallows implicit conversions from ‘String’ to ‘IResource’. The selected value is incompatible with the property type.)

I have an IResource variable for the “From” field, but cannot figure out how to create one for the “To” field. If I use “Path Exists”, it will only return an IResource variable if the path exists. Of course the path cannot exist because I am moving the file to a new folder. How can I specify a new location/name for this file, as an IResource, if the file does not yet exist in that location?

Screenshot 2024-06-14 at 1.54.13 PM

In the screenshot, the string currently in the “To” field is:
“C:\Users\User\Downloads"+CurrentAccountRow(“Description”).ToString() +”"+newInvoiceFilename

Edit: I input the string incorrectly in my post, but the field will not take any string.

@ra.systems

Use path exists for the folder where you want to move and provide the ilresource of folder

If you want to rename then use a rename as well

Cheers

When working with newer UiPath.System.Activities version you can use

LocalResource.FromPath(Path.Combine("C:\Users\User\Downloads",CurrentAccountRow("Description").ToString(),newInvoiceFilename))

About:

  • create a dummy file e.g. write file
  • use path exists
  • use the ILocalResource and let it overwrite the dummy file