Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 String function

Author  Topic 

ninel
Posting Yak Master

141 Posts

Posted - 2006-08-04 : 09:35:12
I have the following path of a file:
"L:\VoicenetSQL\Project\Tampa\Politic\AT0000\Test.csv"

I need to pull out the folder name where the file resides. In this case I would need "AT0000".

How can I use the Instr function to do this? Or can I use something else?

Thanks,
Ninel

dfiala
Posting Yak Master

116 Posts

Posted - 2006-08-04 : 09:41:48
I'd use split
Dim Parts() as String
Dim Path as String = "L:\VoicenetSQL\Project\Tampa\Politic\AT0000\Test.csv"
Parts = Path.Split("\"c)
'The folder will be the second to last part
Dim Folder as String = Parts(Parts.Length-2)


Dean Fiala
Very Practical Software, Inc
Now with Blogging...
http://www.vpsw.com/blogbaby
Microsoft MVP
Go to Top of Page

ninel
Posting Yak Master

141 Posts

Posted - 2006-08-04 : 10:03:45
Thank you so much. It worked.
Go to Top of Page
   

- Advertisement -