# Getting folder names and not location in VB .Net



## <<Onafets>> (May 25, 2011)

Hey guys,
I'm getting a problem with my line of code and can't seem to find a workaround that works (all I can find is VB 6)


```
CheckedListBox1.Items.AddRange(IO.Directory.GetDirectories("my directory here"))
```

This deposits all folders locations into a list box but I only need the actual folder name
e.g:

Deposits: C:\Users\Onafets
But all I want is "Onafets"

Is there any way to do this?

cheers


----------



## Deleted member 3 (May 25, 2011)

system.io.path.getdirectoryname or getfilename, the latter will still return the top folder.

However if you want your username you can use things like environ.


----------

