Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The ultimate .NET file and directory utility library?

Tags:

c#

file

directory

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));
}
like image 555
Serge van den Oever Avatar asked Apr 08 '10 22:04

Serge van den Oever


1 Answers

Although I agree completely with the comments made above, perhaps these libraries might be of interest:

  • NDepend.Path (FileDirectoryPath)
  • FluentPath
  • Extension Methods
  • Alpha FS

Updated post with FileDirectoryPath link, which looks to be an exact match for OPs request.

like image 154
Morten Mertner Avatar answered Nov 15 '22 21:11

Morten Mertner