Skip to content

Instantly share code, notes, and snippets.

@vbfox
Created October 25, 2012 13:59
Show Gist options
  • Save vbfox/3952696 to your computer and use it in GitHub Desktop.
Save vbfox/3952696 to your computer and use it in GitHub Desktop.
Create zips as expected by visual studio as templates
void Main()
{
var root = new DirectoryInfo(@"C:\temp\tmls\Visual Studio Templates");
var works = from dir in root.GetDirectories("*.*", System.IO.SearchOption.AllDirectories)
where dir.Parent.Name == "1033"
select new {
Archive = Path.Combine(dir.Parent.FullName, dir.Name + ".zip"),
Glob = Path.Combine(dir.FullName, "*"),
Dir = dir
};
foreach(var work in works)
{
var args = new [] { "a", "-tzip", "-mx0", work.Archive, work.Glob }
.Select(a => '"' + a + '"');
var arguments = string.Join(" ", args);
Console.WriteLine(arguments);
var p = Process.Start(@"C:\Program Files\7-Zip\7zg.exe", arguments);
p.WaitForExit();
if (p.ExitCode != 0)
{
return;
}
work.Dir.Delete(true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment