Friday, July 14, 2023

Zipping files with 7z.exe

I continue to work on the Disaster Recovery documentation at work. For future reference, this is the DOS batch file I run each morning to back up my RoboHelp projects that reside in my c:\rh folder. I reduced the font size to avoid ugly line breaks - you are welcome! <grin>
cd\
c:
cd rh
REM | BROKEN COMMAND: for /d %%X in (*) do "I:\7-Zip-Command-Line\7za.exe" a "%%X.zip" "%%X\" -mx=5
REM | BROKEN Command: for /d %%X in (*) do "f:\7-Zip-Command-Line\7za.exe" a "%%X.zip" "%%X\" -mx=5
REM | BROKEN Command below this line:
REM | for /d %X in (*) do "c:\Program Files\7-Zip\7z.exe" a "%X.zip" "%X\"
for /d %%X in (*) do "c:\Program Files\7-Zip\7z.exe" a "%%X.zip" "%%X\" -mx=5 –tzip
SET %Today%=%Date:~10,4%_%Date:~4,2%_%Date:~7,2%
ren dr-doc.zip %TODAY%_H-rh-dr-doc_Dr-doc.zip
md "s:\technical documentation\_storage\2023\%TODAY%"
move *.zip "s:\technical documentation\_storage\2023\%TODAY%"
cd\
c:
cd rh-2022
REM | BROKEN Command: for /d %%X in (*) do "f:\7-Zip-Command-Line\7za.exe" a "%%X.zip" "%%X\" -mx=5
REM | UNBROKEN Command below this line:
for /d %%X in (*) do "c:\Program Files\7-Zip\7z.exe" a "%%X.zip" "%%X\" -mx=5 –tzip
ren dr-doc_rh2022.zip %TODAY%_dr-doc_rh2022.zip
move *.zip "s:\technical documentation\_storage\2023\%TODAY%"
pause
md "s:\technical documentation\_storage\2023\%TODAY%\Templates"
cd\
c:
xcopy c:\Users\prhanson\Desktop\Templates\*.* /s "s:\technical documentation\_storage\2023\%TODAY%\Templates"


There was a period in time where my DOS batch file was not functioning correctly so I used the following resource to correct it:
https://stackoverflow.com/questions/34602813/zipping-files-with-7z-exe - Zipping files with 7z.exe

No comments: