Blackslash gets turned into doubble-backslach in file-path

Hello there! :slight_smile:

I’ve run into an obstacle when using backslach for file-path in my robots.

My direct output looks perfectly fine - but behind the workflows ive seen that system replaces "" with “\”

See examples here:

Correct example:
NewDirectoryPath: \local.server\dfs\XX\Backoffice\Automatisering\Robotter\09_Rapport_og_Udtræk\09-04_Datahub_Rapport40_FileDownloader\Downloads\NRGI\01-06-2019 - 01-07-2019

Wrong example:
NewDirectoryPath: \\local.server\dfs\XX\Backoffice\Automatisering\Robotter\09_Rapport_og_Udtræk\09-04_Datahub_Rapport40_FileDownloader\Downloads\NRGI\01-06-2019 - 01-07-2019

I’ve tried to google for a solution, but have not found any specific solution :frowning:
(Ive tried to simply replace \ with \ - but that will not always work with my current file_name setup…)

Looking forward to see your ideas! :slight_smile:

Josef

@JDK,

you can check with this format,

Path.GetFullPath(path).Replace("\\", "\")

In .Net,

'\' is the escaping character.
If you are hardcoding the file path, you have to use two backslash in order to set the file path.

In your file path, if it is one backslash replace with two.
If it is two, replace with four.

Regards,
Karthik Byggari

4 Likes

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