Answers for "file directory path"

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 "file directory path"

Browse Popular Code Answers by Language