All pastes #369182 Raw Edit

Anonymous

public text v1 · immutable
#369182 ·published 2007-02-23 17:12 UTC
rendered paste body
@echo off
SETLocal EnableDelayedExpansion

REM set DEST_FOLDER to a drive other than source drive
REM to speed up the process
REM fedault DEST_FOLDER is current folder
DEST_FOLDER=Y:\QUICKPAR

REM set posting article size in number of lines
REM match with the setting in poewerpost
SET PS=4500

REM set volume size (VS), VM is volume multiflier
SET VM=80
SET /A VS=%VM%*%PS%*128/1000

REM set PAR2 block size (BS) in bytes
REM formular: BS=number_of_line_per_posting_part*128*n
REM default number_of_line_per_posting_part=4500 lines
REM default n=2
SET /A BS=2*%PS%*128

REM set redundancy %
REM default 5%
SET RD=5

IF "!DEST_FOLDER!"=="" (
	SET DEST_FOLDER=%CD%
)

IF NOT EXIST "!DEST_FOLDER!" (
	ECHO.
	ECHO ERROR ERROR ERROR
	ECHO Destination folder "!DEST_FOLDER!" does not exist
	ECHO Script Aborted!
	GOTO :EOF
) ELSE (
	ECHO.
	ECHO Destination folder is "!DEST_FOLDER!"
	ECHO.
)

FOR %%J IN (*) DO (
	SET name=%%J
	SET name=!name: =?!
	ECHO !name!
	IF NOT "!name!"=="zipthenpar.bat" (
		ECHO.
		ECHO ,=====================
		ECHO zipping file "%%J"
		ECHO `=====================
		ECHO.
		CALL :ZIP !name!
	)
)

FOR /D %%I IN (*) DO (
	SET name=%%I
	SET name=!name: =?!
	ECHO !name!
	IF NOT "!name!"=="zipthenpar" (
		ECHO.
		ECHO ,=====================
		ECHO I zipping folder "%%I"
		ECHO `=====================
		ECHO.
		CALL :ZIP !name!
	)
)

PAUSE
GOTO :EOF

:ZIP
SET zipfile=%1
SET zipfile=!zipfile:?= !
REM zipthenpar\7z.exe a -t7z "!DEST_FOLDER!\%zipfile%".7z -r "%zipfile%" -v%VS% -mx0
zipthenpar\rar a -m0 -r -v%VS% "!DEST_FOLDER!\%zipfile%" "%zipfile%"
zipthenpar\par2 c -s%BS% -r%RD% -l "!DEST_FOLDER!\%zipfile%" "!DEST_FOLDER!\%zipfile%"*.rar