Created
August 24, 2017 21:11
-
-
Save Chirishman/4b21ca026228c833264687cc9f5a671e to your computer and use it in GitHub Desktop.
Compress Manga Chapters Individually
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
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