Question:

How can I strip the folder names out of a file path in VB?

by  |  earlier

0 LIKES UnLike

for example

c:\one\two\three\four

I want to pass the folder names on to another part of the program, how would I go about getting them?

 Tags:

   Report

1 ANSWERS


  1. You'd use the Split method of String...

    Dim filePath as String = "c:\one\two\three\four"

    Dim split as String() = filePath.Split('\')

    You could at this point pass the string array "split" and it would contain the elements in the following order

    0 - c:

    1 - one

    2 - two

    3 - three

    4 - four

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.