Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Full path with double backslash (C#)

Tags:

c#

filepath

Is it possible to get a full path with double backslash by using Path.GetFullPath? Something like this:

C:\\Users\\Mammamia\\Videos\\Documents\\CFD\\geo_msh\\cubeOp.txt

instead of this:

C:\Users\Mammamia\Videos\Documents\CFD\geo_msh\cubeOp.txt

Or is there any other method?

like image 469
Shibli Avatar asked Feb 15 '12 13:02

Shibli


2 Answers

Do you mean this?

Path.GetFullPath(path).Replace(@"\", @"\\");
like image 157
greg84 Avatar answered Oct 14 '22 23:10

greg84


C:\\Users\\Mammamia\\Videos\\Documents\\CFD\\geo_msh\\cubeOp.txt is not a valid path, so I'm not sure why you'd want it, but:

Path.GetFullPath(yourPath).Replace("\\", "\\\\");
like image 39
Rich O'Kelly Avatar answered Oct 14 '22 22:10

Rich O'Kelly