I am making a script that finds what the 2nd folder in the path is, how would I do this?
dirA
dirB/C —- I need dirB
indirB – dirD/E
indirE – The file
I need to find the name of the folder in the 2nd level that paths to the file (I marked it with stars).
how would I go about finding this
How about this extension:
testing:
It splits the path by
DirectorySeparatorCharto aString[].You wanted the second level(the third element), this returns “Level2”. Note that the first element is
C:.