If it came to a golf course I would prefer this :

code:
$path = "c:\df\adsfvad\vwed"

$a = split($path,'\')
$folder = $a[ubound($a)]

$folder ?

_________________________