The ultimate c# file and directory utility library?
- by Serge van den Oever
I find myself writing file and directory utility functions all the time, and I was wondering if there is good file and directory library that already implements a more extensive set than available by default in System.IO. The kind of functions I'm looking for is things like:
public static void GetTemporaryDirectory()
{
string tempDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
Directory.CreateDirectory(tempDirectory);
return tempDirectory;
}
public static void CreateEmptyFile(string filename)
{
File.Create(filename).Dispose();
}
public static void CreateEmptyFile(string path, string filename)
{
File.Create(Path.Combine(path, filename)).Dispose();
}
public static void CreateDirectory(string path)
{
Directory.CreateDirectory(path);
}
public static void CreateDirectory(string path, string childpath)
{
Directory.CreateDirectory(Path.Combine(path, childpath));
}