Is there any way to prevent the first half of the path from being displayed?

I am currently implementing a function to notify the destination of a folder where an error has occurred.
However, the path is the full path, and show the address. you will be known as shown below.
it is not good for a security point of view, I would like to prevent the hierarchy above “uipath” directory from being displayed.

【Current situation】
\12.34.56.78\Company\uipath\error\errorfolder

【Path I want to display】
uipath\error\errorfolder

Currently, the above full path is contained in a String variable. Is there anything I can do to make this variable not display the first two levels, or display it from the Uipath level onwards?

Thank you very much.

String.Join("\",YourStringVar.Split("\"c).Skip(3))

Prototyped and checked by:
grafik

A more safe approach could be following:

String.Join("\",YourStringVar.Split({"\"},StringSplitOptions.RemoveEmptyEntries).Skip(2))
1 Like

In addition to ppr’s method, you could use regex which might be a bit more resilient to changes in folder structure. Something like: (?<=\\uipath\\).* would grab everything after the uipath directory. So "uipath" + the regex would get you the full string after the uipath directory only

Thank you very much for the good information.
I’m very happy with the way it works.

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