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));
}
Although I agree completely with the comments made above, perhaps these libraries might be of interest:
Updated post with FileDirectoryPath link, which looks to be an exact match for OPs request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With