get directory of a file
Published: 9. October 2011 | Updated: 9. October 2011License: Microsoft Public License (MS-PL)
Categories: File system » Directories
Tags: C# File System
Import namespace
using System.IO;
Code
string path = @"C:\test\abc.txt"; var directoryName = Path.GetDirectoryName(path); Console.WriteLine(directoryName);Console Output:
C:\test
| Send us feedback about this snippet » |





