I need to access the system.io.fileinfo to populate a varialbe with a folder name.
Folder strucuture is like such
Companies
AB Construcion
Photos
image1.jpg
Presentation
powerpoint1.ppt
XZY Pest Control
Photos
image1.jpg
Presentation
powerpoint.ppt
Excel
costs.xls
I need to always get the AB Constrution or XZY Pest into the variable. I have tried
MsgBox(foundFileInfo.Directory.Parent.Name)
and
MsgBox(foundFileInfo.DirectoryName)
This tends to work some of the time, but if there is a folder inside photos like 2004, 2005 then it screws it up.
I can map a network drive to the root of companies.
Is there maybe a way I can read in the full path (foundFileInfo.DirectoryName) and trim from the first / to the second / say if my path was
g:\xzy pest control\docs\word.doc
Can I just pull out xzy pest control with a trim type statement?
I have most of the rest of this routine written.