Last active
April 19, 2024 16:31
-
-
Save puf/7de4cf6c7decc6f80fac to your computer and use it in GitHub Desktop.
LINQPad script to unzip all files under a given directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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