Problem with Create Folder/Path Exists Activity

Hi all, currently I have an automation that checks for the existence of a list of files, and create them if not available.

most of the time, it is working as intended. However from time to time, the Path Exist activity will return false, and create duplicates of the same folder in that directory.
When I open windows explorer and copy the folder’s directory to notepad, this is what I get.

Duplicated History folder:
C:\RPA<proj>\History
C:\RPA<proj>\?History
C:\RPA<proj>\?5_Friday

when i do a dir on cmd, this is the output. in cmd, i do not see the ?.
the ? is just an empty space.

History
?1_Monday
?2_Tuesday
?3_Wednesday
?4_Thursday
?5_Friday
?6_Saturday
?7_Sunday
?History

Anyone got an idea what causes this?

I notice that the ? is only infront of folders created by the Create Folder activity.
Folders created by me does not have this ?
If my bot uses create folder activity to create a folder named “Test”, I can go to the same location and create a folder with the same name.

I am on Studio 2020.4.1

edit: I think i found the source of the bug. In my Create Folder directory, if i use a string variable(with path stored in the string), the resulting folders will have this ? infront of the foldername.
If i use “C:\RPA Project\History” directly in the create folder activity, the resulting folder does not have a ? infront of the foldername.
Anyone has encountered this before?

How are you generating the path string? Could you show us the workflow?

I think I found the source of the problem.

The path was constructed from an config file(.xlsx). all cells seem to have an unknown/unseen character at the end.

i assigned a strings strString = row(“Value”).ToString.Trim , place a breakpoint there, and ran debug, in debug, strString seem to have the correct value but when i copy and paste it to notepad, i see the ? at the end.

is this a bug? i have never encountered this problem before.

Could you run the debug again and then try to find out the character code for the strange character?
You could for example write this to get the code for the last character:

AscW(strString(strString.Length-1)).ToString

After you have found the character code, you can remove it like this:

strString = strString.Replace(ChrW(615), "")

615 is just an example. Replace it with your character code.

Or if you prefer to use Trim():

strString = strString.Trim(ChrW(615))

I have tried this already. did a for each item in datatable, and write line each line. not all cells has this ? character when i paste it in notepad. so I cant just omit the last character of each cell.

If i do a substring to get the last character, the resulting is a “” in debug mode

however if I copy the “” to notepad(encoding ANSI), it shows “?”

forgot to mention, my xlsx file, some cells are password protected so my user can only change the contents of certain cell…
the cells i am reading are not password protected.

Then what is the character code for the strange character?

1 Like

hmm… i went to Character Code Finder and paste the invisible character and the code is 8203

funny thing is if i put my cursor on the “”, i need to press my left/right arrow key 3 times before it reach the other side. meaning theres an invisible character between the quotation marks. it works here too.

I am not sure what is causing UiPath to read an invisible character from my excel xlsx.

but now that have managed to isolate the problem, i just add a
.Replace(“​”,"")
to remove this invisible character

Thanks @ptrobot for your help too :smiley:

2 Likes

Glad to hear that you have managed to solve it. 8203 (or 200B in hex) is the code for the ‘ZERO WIDTH SPACE’ character. Unicode Character 'ZERO WIDTH SPACE' (U+200B)

My guess is that someone probably copied and pasted the strings into Excel.