Home All Groups Group Topic Archive Search About
Author
23 Oct 2006 6:28 PM
Justin Fancy
Hi Everyone,

I am creating a vb.net application, and i'm almost done. Except for one
problem. I need to be able to change this output:

C:\Documents and Settings\fancyj\My Documents\Visual Studio
Projects\FileDifferencing\bin\Comparison.ldb

into a format that is in another file:

/VisualStudioProjects/FileDifferencing/bin/Comparison.ldb

So, basically I want to cut the leading folders and include only the
subfolder off of the root.

Any suggestions?

Author
23 Oct 2006 6:39 PM
Tim Patrick
If the start of the path is the official My Documents folder for the user,
you could try something like this.

        Dim sourcePath As String
        Dim destPath As String

        sourcePath = "C:\Documents and Settings\fancyj\My Documents\Visual
Studio Projects\FileDifferencing\bin\Comparison.ldb"
        destPath = Replace(sourcePath, My.Computer.FileSystem.SpecialDirectories.MyDocuments,
"")
        destPath = Replace(destPath, "\", "/")

-----
Tim Patrick
Start-to-Finish Visual Basic 2005

Show quoteHide quote
> C:\Documents and Settings\fancyj\My Documents\Visual Studio
> Projects\FileDifferencing\bin\Comparison.ldb
>
> into a format that is in another file:
>
> /VisualStudioProjects/FileDifferencing/bin/Comparison.ldb
>
Author
23 Oct 2006 10:18 PM
Herfried K. Wagner [MVP]
"Justin Fancy" <justinfa***@gmail.com> schrieb:
> I am creating a vb.net application, and i'm almost done. Except for one
> problem. I need to be able to change this output:
>
> C:\Documents and Settings\fancyj\My Documents\Visual Studio
> Projects\FileDifferencing\bin\Comparison.ldb
>
> into a format that is in another file:
>
> /VisualStudioProjects/FileDifferencing/bin/Comparison.ldb
>
> So, basically I want to cut the leading folders and include only the
> subfolder off of the root.

In addition to the other reply, check out the shared methods of
'System.IO.Path' and the 'System.Uri' class.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>