Directory.GetFiles returning entire path, I only want the filename?
Posted
by blerh
on Stack Overflow
See other posts from Stack Overflow
or by blerh
Published on 2010-04-26T23:10:41Z
Indexed on
2010/04/26
23:13 UTC
Read the original article
Hit count: 233
This is the code I have set up to scan a directory of files:
Dim fileArray() As String
fileArray = Directory.GetFiles(System.AppDomain.CurrentDomain.BaseDirectory & "help\")
And it successfully gets all files in the directory, but it gets their absolute paths aswell. For example, one of the entries in fileArray()
is:
F:\Project\Project\bin\x86\Debug\help\book_troubleshoot.html
And I want it to just be:
book_troubleshoot.html
Is there a way to do this without parsing through all the array entries to trim off the path?
Thanks.
© Stack Overflow or respective owner