My question is very similar to:
Rename extracted file based on zip file in Batch
I have 470 .zip files which each contain two files (.mp3 & .cdg) - they are karaoke files.
The ZIP files are cleanly named (Abba - Money Money Money.zip), however the contents, of the ZIP file need to be renamed (e.g FIK001ABBA_02_-ABBA-_MONEY_MONEY_MONEY.mp3).
So, I would like the batch file to do the following:
- Extract the files
- Rename the contents, of the zip file to the zip file name.
- e.g:
- FIK001ABBA_02_-ABBA-_MONEY_MONEY_MONEY.mp3
- FIK001ABBA_02_-ABBA-_MONEY_MONEY_MONEY.cdg
- renamed to
- Abba - Money Money Money.mp3
- Abba - Money Money Money.cdg
- The files are then added back into the zip file
I've looked over the similar posting above, however, it talks about unzipping *.7z my files are *.Zip. Please explain :-)
Here is the code:
md textfiles
for %%f in (*.zip) do (
winzip -v "%%f"
move *.txt textfiles\%%~nf.txt
)
xcopy textfiles\*.txt originalfolder
rd textfiles /s /q
Just a few notes:
DEL %1
line.WINZIP
and7ZIP
are different, but similar productsWINZIP
, which has a pair of command-line utilities available (WZZIP
andWZUNZIP
) aimed at batch useWZZIP
version (v3.2, build 8668) where the-m
(move) option willdelete
the directory if"dirname\*.*
is MOVED into the zip. I'll chase this up - but that's why the RD of the work directory is gated and placed with the MD within the:process
routine, not in the main routine.