The ultimate .NET file and directory utility library?
Posted
by Serge van den Oever
on Stack Overflow
See other posts from Stack Overflow
or by Serge van den Oever
Published on 2010-04-08T22:02:19Z
Indexed on
2010/04/11
0:03 UTC
Read the original article
Hit count: 264
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));
}
© Stack Overflow or respective owner