HI all.
I have several folders that have folders inside of them. I'm trying to get just the top level folder name, such as,
I have:
D:\Music\Rock\Scorpions
D:\Music\Rock\Scorpions\World Wide Live
I just want to return "Music" for both lines. I know how to get a list of all the directories for a certain drive, but when I scan directories for all files, I just want to return the top level directory name.
Thanks for your help!
Zcast
Getting Main directory Name
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

VulpesRank #55 · 29.2K reputationPosted Jan 22, 2012, 5:21 AM EST
This splits the path using the '\' as the separator and then selects the second string in the resulting array, which has an index of 1.