To create an array of folder names from the String variable FilePath, the method that will return an array of only the folder names is:
Split(FilePath,"").StringSplitOptions.RemoveEmptyEntries
This method uses the String.Split method, which returns an array of strings that are separated by a specified delimiter. The delimiter in this case is the backslash character ("") which is used to separate the folder names in the file path. The StringSplitOptions.RemoveEmptyEntries option is used to remove any empty entries from the resulting array, such as the one before the first backslash or after the last backslash1. For example, if the FilePath variable has the value:
FilePath = “C:\Users\UiPathRobot\Documents\Technologies”
Then the method Split(FilePath,"").StringSplitOptions.RemoveEmptyEntries will return an array of four strings:
{“C”, “Users”, “UiPathRobot”, “Documents”, “Technologies”}
These are the folder names in the file path, without any empty entries.