DOS batch to zip archive and delete folder using 7zip

Save following commands to a text file and save it as archive.bat :

@echo offf
echo 7za a -r -tzip %~nx1.zip -mx9 %~f1\*.* 
7za a -r -tzip %~nx1.zip -mx9 %~f1\*.* 
rmdir /s/q %~f1
pause

!!Caution, if you don’t have 7za installed it will only delete that folder!!

Usage:

Drop any directory to the batch file, it will create a zip archive and delete that folder.

Similarly you can use following batch to just store (uncompressed) your folder:

@echo offf
echo 7za a -r -tzip %~nx1.zip -mx0 %~f1\*.* 
7za a -r -tzip %~nx1.zip -mx0 %~f1\*.* 
rmdir /s/q %~f1
pause

If you don’t want to delete your folder just remove rmdir line.



NS Weight Release