Skip to content

Instantly share code, notes, and snippets.

@puf
Last active April 19, 2024 16:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save puf/7de4cf6c7decc6f80fac to your computer and use it in GitHub Desktop.
Save puf/7de4cf6c7decc6f80fac to your computer and use it in GitHub Desktop.
LINQPad script to unzip all files under a given directory
// This LINQPad script (easily converted into a regular C# program) extracts all zip files under a specific directory.
// makes use of the ZipUtility from http://linqpadsamples.codeplex.com/wikipage?title=Unzip%20a%20file%20using%20COM%20and%20dynamic
var files = Directory.EnumerateFiles(@"C:\Test Data\Gutenberg\pgdvd042010", "*.zip", SearchOption.AllDirectories).ToArray();
var dc = new DumpContainer().Dump();
var index=0;
var count=files.Count();
foreach (var file in files) {
dc.Content = string.Format("{0}/{1}: {2}", index++, count, file);
ZipUtility.UnzipFile(file, Path.GetDirectoryName(file));
File.Delete(file);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment