tags:

views:

154

answers:

1

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));
}
+2  A: 

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.

Morten Mertner
The extension methods certainly look interesting
cmroanirgo