Move File - "Illegal characters in path"

Hello, is there are way to figure out what UiPath is calling “illegal characters”? I’m trying to use Move File with a few variables to locate a file then move it from one folder to another.

Essentially, the file paths would be:
From Path: C:\Users\name\Documents\FromFolder\FileName.pdf (brought in via a variable that was defined earlier in the workflow)
To Destination: C:\Users\name\Documents\ToFolder\FileName.pdf (variable defined earlier in the workflow through concatenating other variables).

I know this isn’t a ton to go off of but any ideas on what “illegal characters” could be is appreciated. They look like normal file paths to me otherwise and I’m not sure how to change them while having the workflow be able to still locate the paths. Thanks!

Hi,

The Destination should be folder name not file name.

Use

C:\Users\name\Documents\ToFolder in Destination and give a try.

  1. Check whether the source file and destination path are exists programmatically before moving the file using methods File.Exists and Directory.Exists respectively .

  2. Use the below methods to check whether the path and file name has any invalid characters and replace as needed.

Path.GetInvalidFileNameChars

Path.GetInvalidPathChars

HI,

Where you able to move files or not, what is the error you are getting now.

Paste the screen shot of the error.

Hey , Try with this workflow move file.xaml (8.1 KB)
In this, Select the file you would like to move and in the Move file Activity give your destination address.
Think this might help you. Any queries please ask.

Regards,
Suruchi

Hi all - thank you so much for the responses!!! Using mageshbala90’s suggestions I realized there was an issue with using one of my variables in setting up the file path, it was the output of a data table and was sending data to two lines for some reason so it wasn’t prompting the correct file path.

Thank you again for the help, really appreciate it!

1 Like

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