|
|
|||||||
Hi, How do I strip a filename from a path to just leave me the the base folder? Eg if I have: c:\document and settings\users\test.txt strip the path out to give: c:\document and settings\users\ Thanks in advance. Darren |
||||||||
|
|
|||||||
You could always split and rejoin. Code: $file = "c:\document and settings\users\test.txt" $array = split($file,"\") for $x = 0 to ubound($array) -1 $path = $path + $array[$x] + "\" next ? $path |
||||||||
|
|
|||||||
Yep that does the trick, thanks for that... Darren |
||||||||
|
|
|||||||
You don't actually need the loop: Code: $file = "c:\document and settings\users\test.txt" $array = split($file,"\") $path=Join($array,"\",UBound($array))+"\" $path+@CRLF |
||||||||
|
|
|||||||
The PathSplit UDF returns a 4 element array with the server name (if share), share name or drive letter, folder path, and file name items. It's posted here, and the latest is on my web site in the Resources section. Glenn |