Created
October 25, 2012 13:59
-
-
Save vbfox/3952696 to your computer and use it in GitHub Desktop.
Create zips as expected by visual studio as templates
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
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