MultiPar Batch Script

A friend and I use MultiPar to create recovery files for data to be backed up online. I found the process inefficient because I was not able to select a batch of files in a directory and have recovery files for each individual file. Doing that resulted in recovery files for all of the files combined. That will not work for me because I am dealing with hundreds of files at once. I want to be able to select a directory with hundreds of files, even files in subdirectories, and have each file have its own recovery files. That way I can recover a single file if it becomes corrupted.

My friend created a script that would run MultiPar in command line. You merely put the file in the directory where you wanted all files to have recovery files created. The problem was I have all my files on a NAS so the script would not work. I also have many files in several subdirectories. Luckily, I know enough to modify some types of existing code.

The script below was created by my friend and I. Here are some things you need to change before using it.

  • The ability to have the process run in a remote directory is the text in green. You can delete the entire line in green if you do not need to run the process in a remote directory.
  • The ability to have the process run recursively is the text in red. Just make sure you want all files in all subdirectories to have recovery files created. You can delete the entire line in red if you do not need to run the process in a remote directory.
  • You must select the file type to have recovery files created. I am working with 7z files and I highlighted that in text in blue. My friend and I are only working with one file type and I do not know if you can have the process select all file types.
  • You must select the directory where the MultiPar par2j64.exe is located. This is the text in orange. In my case, the file was located in C:\Users\Me\AppData\Local\.

You can create the script with a text editor (Notepad). Create a new document, paste the text between the dashes (——), make your changes, and then save the file as a .bat file.

——————————————————————

SETLOCAL

SET par2_path=”C:\Users\Me\AppData\Local\MultiPar\par2j64.exe”
pushd \\10.0.0.5\data\online backup\folder 1

REM we’re going to look for files that end in .7z
REM rr sets the redundancy %, rr5 is 5% redundant
REM rd2 uses powers of 2 for sizing the files
REM rf8 makes 8 recovery files. You can change this

for /r %%v in (*.7z) DO (
%par2_path% c /sm2048 /rr5 /rd2 /rf8 “%%v.par2” )
for /R “\\10.0.0.5\data\online backup\folder 1” %%f in (*.7z) do echo “%%f”

IF ERRORLEVEL 1 GOTO End

:NextFile
SHIFT

:End
ENDLOCAL

——————————————————————

This script may not be the best way to run MultiPar on multiple files or very elegant, so let me know if you have a better way of doing it.

You can get MultiPar here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.