Popa
Popa

Reputation: 283

Split to volumes using batch

I am using the following command in a batch file in order to archive MY_LARGE_FOLDER and my .rar file is too big:

WinRAR a -r D:\MY_LARGE_FOLDER.rar D:\MY_LARGE_FOLDER\*.txt D:\MY_LARGE_FOLDER\ 
  1. How can I archive MY_LARGE_FOLDER, into small .rar files of 4MB each using batch file? (or in other words, How to use the "Split to volumes, bytes" option using batch file?)

Thanks.

Thanks for the help! I used the -v switch:

          WinRAR a -r **-v4000** D:\MY_LARGE_FOLDER.rar D:\MY_LARGE_FOLDER\*.txt D:\MY_LARGE_FOLDER\

and I got now 4 files of 4000 bytes each but after opening some of the files I saw that the files are duplicated on more than one archive (e.g. on Part01.rar and on Part02.rar) ??? 1. I also tried the -s (solid) switch and the result is the same?
How can I solve it?

Upvotes: 4

Views: 8546

Answers (3)

Seshu Tarapatla
Seshu Tarapatla

Reputation: 43

Well, you can use -v flag to set the volume size. And based on that WinRAR will create volumes. Let us see an example:

winrar.exe a -v100m output.rar "{path_to_large_folder_or_file}"

This command will create volumes of size 100mb. You can use any integer with: [b | k | m | g] -> bytes, kilobytes, megabytes, gigabytes.

Upvotes: 1

Mofi
Mofi

Reputation: 49096

There are two "manuals" installed with WinRAR:

  1. The help file WinRAR.chm which has on tab Contents the item Command line mode with the subitem Switches with a link to page Switch -V<n>[k|b|f|m|M|g|G] - create volumes, and
  2. the text file Rar.txt in program files folder of WinRAR which is the manual for console version Rar.exe. It contains nearly the same information as the help file regarding the available switches and their explanation.

I suggest to use in a batch file the console version with the command line:

"%ProgramFiles%\WinRAR\Rar.exe" a -cfg- -ep1 -idcdp -m5 -md4m -r -s -v4M "D:\MY_LARGE_FOLDER.rar" "D:\MY_LARGE_FOLDER\"

Console application Rar.exe compresses D:\MY_LARGE_FOLDER\ with all files and subfolders with folder name MY_LARGE_FOLDER included into an archive with nearly no output to console window using best compression creating a multivolumne solid archive with 4 MB dictionary size (in case of lots of small *.txt files) and 4 MB per archive file (volume).

There can be used alternatively:

"%ProgramFiles%\WinRAR\Rar.exe" a -cfg- -ep1 -inul -m5 -md4m -r -s -v4M "D:\MY_LARGE_FOLDER.rar" "D:\MY_LARGE_FOLDER"

That creates nearly same archive with the difference that folder name MY_LARGE_FOLDER is not included in the archive (backslash at end removed) and no message written to console window (-inul instead of -idcdp).

Upvotes: 6

shmnff
shmnff

Reputation: 739

My solution for 20Mb volumes was:

"%ProgramFiles(x86)%\WinRAR.Rar.exe" a -cfg- -ep1 -idcdp -m5 -md4096 -r -s -v20M "C:\test.rar" "C:\test\"

Upvotes: 0

Related Questions