Skip to content

Instantly share code, notes, and snippets.

@Chirishman
Created August 24, 2017 21:11
Show Gist options
  • Save Chirishman/4b21ca026228c833264687cc9f5a671e to your computer and use it in GitHub Desktop.
Save Chirishman/4b21ca026228c833264687cc9f5a671e to your computer and use it in GitHub Desktop.
Compress Manga Chapters Individually
function Compress-ListedFiles {
Param(
[Parameter(Mandatory=$True,Position=1)]
[array]$FileNames,
[Parameter(Mandatory=$True,Position=2)]
[string]$OutputPath
)
if($FileNames.Count -ne 0) {
#[string]$Zip = "$env:ProgramFiles\7-Zip\7z.exe"
[string]$Zip = "C:\Program Files\7-Zip\7z.exe"
[array]$arguments = @("a", "-y", "-m0=lzma2", "-ms=on", "-mmt=on", "-md=64m", "-mfb=128", $outputPath) + $FileNames
& $Zip $arguments ;
}
}
Function Compress-Manga {
Param(
$MangaDirectory
)
gci $MangaDirectory | %{
$ThisArchive = @{
OutputPath = "$MangaDirectory\$($_ | select -ExpandProperty Name).cb7"
FileNames = gci ($_ | select -ExpandProperty FullName) | select -ExpandProperty FullName
}
Compress-ListedFiles @ThisArchive
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment