Answers for "path of the directory"

0

Get directory path of file path

string filePath = @"C:MyDirMySubDirmyfile.ext";
string directoryName = Path.GetDirectoryName(filePath);
Console.WriteLine($"GetDirectoryName('{filePath}') returns '{directoryName}'");

//This code produce the following output:
GetDirectoryName('C:MyDirMySubDirmyfile.ext') returns 'C:MyDirMySubDir'
Posted by: Guest on September-17-2021

Code answers related to "path of the directory"

Browse Popular Code Answers by Language