Illegal characters




How do I copy a file if the path is for instance? "\Aasv081\ml_17576$\TMP\nezivot.xml"
Because the UiPath error window shows: Copy file : Illegal characters in path.

Moreover, the strange thing is that when I use the path as fixed value it is working, but when I use it as an variable, this error pops up.

Thanks a lot in advance.


Not sure if it fixes anything, but check if you get the same error if you replace"\" with "\\" in your variable.

Or filepath.Replace("\","\\")


I’m Kyunghoon

I have the same error.
The replace method is the same.
I declare a variable to perform assign but it is the same
Is there any solution?


Hi @goldpapa,

use this code to remove illegal characters from the path.

System.Text.RegularExpressions.Regex.Replace(unCleanString, @"[\\/:*?""<>|]", string.Empty).Trim()



Hi arivu96!
thank you for telling me.

Now I know, I need to remove illegal characters!


Hello vvaidya,

is there any other way? I need the path to stay the same, I cannot really replace characters in the path as I wont get the exact file I am looking for. Please help.