Relative path

  • Thread starter Thread starter Alan T
  • Start date Start date
A

Alan T

I got a relative path, eg."..\..\temp\documents"

Is there a function to convert that into full absolute path?
 
I'm very new to C#, but I would think you can just make both paths
strings and add them together.
for example:
string a would = "c:\program files\"
string b would = "temp\documents\"
string c = string a + string b

Sorry for not using C# code, but I'm still learning and it was faster to
show my example as it is rather than look up the proper code. I wanted
to be sure I didn't give you false info if I used incorrect syntax, not
that yo uwouldn't have caught any errors I made.
 
Hi Alab,

This is how you can do that.

string fullpath = System.IO.Path.GetFullPath("..\..\temp\documents");
 
Hi Alan,

This is how you can do this.

string fullpath = System.IO.Path.GetFullPath("..\..\temp\documents");

- karthik D V
 
Thanks.

How about the other way around?
"C:\mydoc\employee\d1.doc" into the relative path?
 
@ Alan T
Hi Ted,
Just wonder are you in Australia?

No, I am not. I'm in the US and a bit embarrassed at how easy the
solution was LOL. Hey, I tried but I have a lot more to learn
(obviously):P
 
Back
Top