Batch Guru needed?

Associate
Joined
28 May 2021
Posts
1,504
Location
St Albans
I am trying to process some archives (comic CBR/CBZ files which are basically RAR/ZIP files) to convert from CBR to CBZ and remove some unwanted bits at same time

1) Unpack to temp dir
2) If this creates a sub directory, move all contents to the root processing directory
3) Delete some unwanted files & filetypes
4) Repack in new archive format

1 & 3 are easy
2 I can't get working
4 works but using %1 I end up with FILENAME.CBR getting processed to FILENAME.CBR.CBZ

Code:
@ECHO OFF

rem unpack (WORKS)
"C:\Program Files\7-Zip\7z.exe" e %1 -oC:\Temp -r

rem move all files from any folders to root UNFINISHED
rem cd c:\temp
rem dir /b /AD-H >> output  I can list the extra DIR it creates but???
rem move output /s c:\temp   OBV doesnt work like this
rem delete output  Just need to tidy up after

rem unwanted files
del *.xml
del *.txt

rem Remake CBZ, rename file, move to desktop (WORKS but not great)
"C:\Program Files\7-Zip\7z.exe" a %1.cbz
del *.jpg  REM really just need to empty the temp dir
forfiles /S /M *.CBZ /C "cmd /c rename @file @fname"
forfiles /S /M *.CBR /C "cmd /c rename @file @fname.cbz"
move *.cbz %USERPROFILE%\Desktop\

rem pause

rem Still need to be able to drop 10 files onto and have it process them ONE at a time

And ideally I dont want to drop files one at a time onto the BAT file, either groups of CBRs or a folder even better
 
Back
Top Bottom