Skip to content

Instantly share code, notes, and snippets.

@SanSan-
Created February 27, 2024 11:40
Show Gist options
  • Save SanSan-/2570c75b6acbd7172d550abc30e50e85 to your computer and use it in GitHub Desktop.
Save SanSan-/2570c75b6acbd7172d550abc30e50e85 to your computer and use it in GitHub Desktop.
Walk in current dir and convert all chapters to cbz
$current = Get-Location
$vols = Get-ChildItem -Path $current.Path -Directory
foreach ($vol in $vols)
{
$chapters = Get-ChildItem -Path $vol.Name -Directory
foreach ($chapter in $chapters)
{
$name = $chapter.Name
$fullName = $chapter.FullName
$zipName = "$name.zip"
$leadZerosName = '{0:d3}' -f [int]$name
$cbzName = "Ch.$leadZerosName.cbz"
Compress-Archive -Path $fullName -DestinationPath $zipName
Write-Output "Zip $fullName complete!"
Rename-Item -Path $zipName -NewName $cbzName
Write-Output "Rename to $cbzName complete!"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment