I have a Path;
\\\\username-txd\location\Configuration\MediaManagerConfig\Web.config
I want to create a copy of file at one position up in the same folder i.e.
\\\\username-txd\location\Configuration\Web.config
Can anyone help me with the code since I am new to C#
DirectoryInfo.Parent
returns this MediaManagerConfig
and you can do little bit string manupalition like;
var di = new DirectoryInfo(@"\\\\username-txd\location\Configuration\MediaManagerConfig\Web.config");
Console.WriteLine(di.FullName.Replace(di.Parent.Name + Path.DirectorySeparatorChar, ""));
Result will be;
\\username-txd\location\Configuration\Web.config
If you want 4 back slash based on your result, your can replace with \\
to \\\\
as well.