Professional Documents
Culture Documents
Rar
Rar
~~~~~~~~~~~~~
RAR 5.01 console version
~~~~~~~~~~~~~~~~~~~~~~~~
=-=-=-=-=-=-=-=-=-=-=-=-=-=Welcome to the RAR Archiver!
-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Introduction
~~~~~~~~~~~~
RAR is a console application allowing to manage archive files
in command line mode. RAR provides compression, encryption,
data recovery and many other functions described in this manual.
RAR supports only RAR format archives, which have .rar file name
extension by default. ZIP and other formats are not supported.
Even if you specify .zip extension when creating an archive, it will
still be in RAR format. Windows users may install WinRAR, which supports
more archive types including RAR and ZIP formats.
WinRAR provides both graphical user interface and command line mode.
While console RAR and GUI WinRAR have the similar command line syntax,
some differences exist. So it is recommended to use this rar.txt manual
for console RAR (rar.exe in case of Windows version) and winrar.chm
WinRAR help file for GUI WinRAR (winrar.exe).
Configuration file
~~~~~~~~~~~~~~~~~~
RAR for Unix reads configuration information from the file .rarrc
in the user's home directory (stored in HOME environment variable)
or in /etc directory.
RAR for Windows reads configuration information from the file rar.ini,
placed in the same directory as the rar.exe file.
This file may contain the following string:
switches=any RAR switches, separated by spaces
For example:
switches=-m5 -s
Environment variable
~~~~~~~~~~~~~~~~~~~~
Default parameters may be added to the RAR command line by establishing
an environment variable "RAR".
For instance, in Unix following lines may be added to your profile:
RAR='-s -md1024'
export RAR
RAR will use this string as default parameters in the command line and
highest priority
lower priority
lowest priority
Log file
~~~~~~~~
If the switch -ilog is specified in the command line or configuration
file, RAR will write informational messages, concerning errors
encountered while processing archives, into a log file. Read switch
-ilog description for more details.
The file order list for solid archiving - rarfiles.lst
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rarfiles.lst contains a user-defined file list, which tells RAR
the order in which to add files to a solid archive. It may contain
file names, wildcards and special entry - $default. The default
entry defines the place in order list for files not matched
with other entries in this file. The comment character is ';'.
In Windows this file should be placed in the same directory as RAR
or in %APPDATA%\WinRAR directory, in Unix - to the user's home directory
or in /etc.
Tips to provide improved compression and speed of operation:
- similar files should be grouped together in the archive;
- frequently accessed files should be placed at the beginning.
Normally masks placed nearer to the top of list have a higher priority,
but there is an exception from this rule. If rarfiles.lst contains such
two masks that all files matched by one mask are also matched by another,
that mask which matches a smaller subset of file names will have higher
priority regardless of its position in the list. For example, if you have
*.cpp and f*.cpp masks, f*.cpp has a higher priority, so the position of
'filename.cpp' will be chosen according to 'f*.cpp', not '*.cpp'.
RAR command line syntax
~~~~~~~~~~~~~~~~~~~~~~~
Syntax
RAR <command> [ -<switches> ] <archive> [ <@listfiles...> ]
[ <files...> ] [ <path_to_extract\> ]
Description
Command line options (commands and switches) provide control of
creating and managing archives with RAR. The command is a string (or a
single letter) which commands RAR to perform a corresponding action.
Switches are designed to modify the way RAR performs the action. Other
parameters are archive name and files to be archived into or extracted
ch
cw
Examples:
1) rar cw arc comment.txt
2) rar cw -scuc arc unicode.txt
3) rar cw arc
d
i[i|c|h|t]=<string>
Find string in archives.
Supports following optional parameters:
i - case insensitive search (default);
c - case sensitive search;
h - hexadecimal search;
t - use ANSI, Unicode and OEM character tables (Windows only);
If no parameters are specified, it is possible to use
the simplified command syntax i<string> instead of i=<string>
It is allowed to specify 't' modifier with other parameters,
for example, ict=string performs case sensitive search
using all mentioned above character tables.
Examples:
1) rar "ic=first level" -r c:\*.rar *.txt
Perform case sensitive search of "first level" string
l[t[a],b]
List archive contents [technical [all], bare].
'l' command lists archived file attributes, size, date,
time and name, one file per line. If file is encrypted,
line starts from '*' character.
'lt' displays the detailed file information in multiline mode.
This information includes file checksum value, host OS,
compression options and other parameters.
'lta' provide the detailed information not only for files,
but also for service headers like NTFS streams
or file security data.
'lb' lists bare file names with path, one per line,
without any additional information.
You can use -v switch to list contents of all volumes
in volume set: rar l -v vol.part1.rar
Commands 'lt', 'lta' and 'lb' are equal to 'vt', 'vta'
and 'vb' correspondingly.
m[f]
rn
v[t[a],b]
--
add all files from the current directory to the solid archive
'-StrangeName'
RAR a -s -- -StrangeName
-@[+]
-ac
-ad
-ag[format]
Generate archive name using the current date and time.
year
month
month name as text string (Jan, Feb, etc.)
a week number (a week starts with Monday)
day of week number (Monday is 1, Sunday - 7)
day of month
day of year
hours
minutes (treated as minutes if encountered after hours)
minutes (treated as minutes regardless of hours position)
seconds
archive number. RAR searches for already existing archive
with generated name and if found, increments the archive
number until generating a unique name. 'N' format character
is not supported when creating volumes.
When performing non-archiving operations like extracting,
RAR selects the existing archive preceding the first
unused name or sets N to 1 if no such archive exists.
-ao
-ap
-as
-cl
-cu
-c-
-df
-dh
-dr
-ds
-dw
hard disks, but may fail to overwrite the original file data
on solid state disks, as result of SSD wear leveling technology
and more complicated data addressing.
-ed
-ee
-en
-ep
-ep1
Exclude base dir from names. Do not store the path entered in
the command line.
Example:
all files and directories from the directory tmp will be added
to the archive 'test', but the path in archived names will not
include 'tmp\'
rar a -ep1 -r test tmp\*
Expand paths to full. Store full file paths (except the drive
letter and leading path separator) when archiving.
-ep3
-e[+]<attr>
Specifies file exclude or include attributes mask.
<attr> is a number in the decimal, octal (with leading '0')
or hex (with leading '0x') format.
By default, without '+' sign before <attr>, this switch
defines the exclude mask. So if result of bitwise AND between
<attr> and file attributes is nonzero, file would not be
processed.
If '+' sign is present, it specifies the include mask.
Only those files which have at least one attribute specified
-ilog[name]
Log errors to file (registered version only).
Write error messages to rar.log file. If optional 'name'
parameter is not specified, the log file is created
using the following defaults:
Unix:
.rarlog file in the user's home directory;
Windows: rar.log file in %APPDATA%\WinRAR directory.
If 'name' parameter includes a file
RAR will create the log file in the
mentioned above using the specified
and name to 'name' parameter if you
the location of log file.
-ioff
-isnd
Enable sound.
-k
-kb
-log[fmt][=name]
Write names to log file.
This switch allows to write archive and file names to specified
text file in archiving, extracting, deleting and listing commands.
Its behavior is defined by 'fmt' string, which can include one
or more of following characters:
A - write archive names to log file. If RAR creates or processes
volumes, all volume names are logged.
F - write processed file names to log file. It includes
files added to archive and extracted, deleted or listed
files inside of archive.
P - if log file with specified name is exist, append data
to existing file instead of creating a new one.
U - write data in Unicode format.
If neither 'A' nor 'F' are specified, 'A' is assumed.
'name' parameter allows to specify the name of log file.
It must be separated from 'fmt' string by '=' character.
If 'name' is not present, RAR will use the default rarinfo.log
file name.
It is allowed to specify several -log switches in the same
command line.
This switch can be particularly useful, when you need to process
an archive created with -ag or -v switches in a batch script.
You can specify -loga=arcname.txt when creating an archive
and then read an archive name generated by RAR from arcname.txt
with an appropriate command. For example, in Windows batch file
it can be: set /p name=<arcname.txt.
Examples:
1) write names of created volumes to vollist.txt:
rar a -v100m -loga=vollist.txt volume.rar c:\data
2) write the generated archive name to backup.txt in Unicode:
rar a -ag -logau=backup.txt backup.rar myfiles\*
3) write names of tested volumes to vollist.txt and names
of tested archived files inside of volumes to filelist.txt:
rar t -log=vollist.txt -logf=filelist.txt volume.part01.rar
-m<n>
-m0
-m1
-m2
-m3
-m4
store
fastest
fast
normal
good
-m5
best
audio compression;
true color (RGB) data compression;
delta compression;
32-bit x86 executables compression;
64-bit Intel Itanium executables compression;
text compression.
RAR 5.0 archive format supports only 'D' and 'E' values.
'+' sign at the end of switch applies the selected algorithm
module to all processed data, '-' disables the module at all.
If no sign is specified, RAR will choose modules automatically,
-oh
-oi[0-4][:<minsize>]
Save identical files as references.
Switch -oi0 (or just -oi-) turns off identical file processing,
so such files are compressed as usual files. It can be used to
override another -oi value stored in RAR configuration.
If -oi1 (or just -oi) is specified, RAR analyzes the file
contents before starting archiving. If several identical files
are found, the first file in the set is saved as usual file
and all following files are saved as references to this first
file. It allows to reduce the archive size, but applies some
restrictions to resulting archive. You must not delete or rename
the first identical file in archive after the archive was
created, because it will make extraction of following files
-os
-ow
-o[+|-] Set the overwrite mode. Can be used both when extracting
and updating archived files. Following modes are available:
-p[p]
-o
-o+
Overwrite all
(default for updating archived files);
-o-
-p-
Disable recursion.
Even without -r switch RAR can enable the recursion
automatically in some situations. Switch -r- prohibits it.
If you specify a directory name when archiving and if such
name does not include wildcards, by default RAR adds
the directory contents even if switch -r is not specified.
Also RAR automatically enables the recursion if disk root
without wildcards is specified as a file mask. Switch -rdisables such behavior.
For example:
rar a -r- arc dirname
command will add only the empty 'dirname' directory and ignore
its contents. Following command:
rar a -r- arc c:\
will compress contents of root c: directory only and
will not recurse into subdirectories.
-r0
Similar to -r, but when used with the commands 'a', 'u', 'f',
'm' will recurse into subdirectories only for those file masks,
which include wildcard characters '*' and '?'.
This switch works only for file names. Directory names without
a file name part, such as 'dirname', are not affected by -r0
and their contents is added to archive completely unless -rswitch is specified.
Example:
rar a -r0 docs.rar *.doc readme.txt
add *.doc files from the current directory and its subdirectories
and readme.txt only from the current directory to docs.rar
archive. In case of usual -r switch, RAR would search for
readme.txt in subdirectories too.
-ri<p>[:<s>]
Set priority and sleep time. Available only in RAR for Windows.
This switch regulates system load by RAR in multitasking
environment. Possible task priority <p> values are 0 - 15.
If <p> is 0, RAR uses the default task priority.
<p> equal to 1 sets the lowest possible priority,
15 - the highest possible.
Sleep time <s> is a value from 0 to 1000 (milliseconds).
-s<N>
-sc<charset>[objects]
Specify the character set for list files, log files
and archive comment files.
'Charset' parameter is mandatory and can have one
of the following values:
U - Unicode;
-sfx[name]
Create SFX archives. If this switch is used when creating a new
archive, a Self-Extracting archive (using a module in file
default.sfx or specified in the switch) would be created.
In the Windows version default.sfx should be placed in the
same directory as the rar.exe, in Unix - in the user's
home directory, in /usr/lib or /usr/local/lib.
Example:
rar a -sfxwincon.sfx myinst
create SelF-eXtracting (SFX) archive using wincon.sfx
SFX-module.
-si[name]
Read data from stdin (standard input), when creating
an archive. Optional 'name' parameter allows to specify
a file name of compressed stdin data in the created
archive. If this parameter is missing, the name will be
set to 'stdin'. This switch cannot be used with -v.
Example:
type Tree.Far | rar a -siTree.Far tree.rar
will compress 'type Tree.Far' output as 'Tree.Far' file.
-sl<size>
Process only those files, which size is less than
specified in <size> parameter of this switch.
Parameter <size> must be specified in bytes.
-sm<size>
Process only those files, which size is more than
specified in <size> parameter of this switch.
Parameter <size> must be specified in bytes.
-sv
-sv-
-s-
-t
-ta<date>
Process only files modified after the specified date.
Format of the date string is YYYYMMDDHHMMSS.
It is allowed to insert separators like '-' or ':' to
the date string and omit trailing fields. For example,
the following switch is correct: -ta2001-11-20
Internally it will be expanded to -ta20011120000000
and treated as "files modified after 0 hour 0 minutes
0 seconds of 20 November 2001".
-tb<date>
Process only files modified before the specified date.
Format of the switch is the same as -ta<date>.
-tk
-tl
Set archive time to newest file. Forces RAR to set the date of a
changed archive to the date of the newest file in the archive.
-tn<time>
Process files newer than the specified time period. Format
of the time string is:
[<ndays>d][<nhours>h][<nminutes>m][<nseconds>s]
For example, use switch -tn15d to process files newer
than 15 days and -tn2h30m to process files newer than
2 hours 30 minutes.
-to<time>
Process files older than the specified time period. Format
of the switch is the same as -tn<time>.
-ts<m,c,a>[N]
Save or restore file time (modification, creation, access).
Switch -tsm instructs RAR to save file modification time,
-tsc - creation time and tsa - last access time.
For
the
the
2 the
-v
-vp
-w<p>
-x<f>
('\' for Windows and '/' for Unix). For example, "*tmp*\" mask
will exclude all directories matching "*tmp*" and "*\tmp\" will
exclude all 'tmp' directories. Since wildcards are present,
both masks will be applied to contents of current directory
and all its subdirectories.
If you wish to exclude only one directory, specify the exact
name of directory including the absolute or relative path
without any wildcards. In this case you do not need to append
the path separator to mask, which is required only for directory
exclusion masks containing wildcards to distinguish them
from file exclusion masks.
Examples:
1) rar a -r -x*.jpg -x*.avi rawfiles
compress all files except *.jpg and *.avi in current directory
and its subdirectories;
2) rar a -r -x*\temp\ savec c:\*
compress all files on the disk c: except 'temp' directories
and files inside of 'temp' directories;
3) rar x -x*.txt docs
extract all files except *.txt from docs.rar.
-x@<lf> Exclude files listed in the specified list file. If you use -x@
without the list file name parameter, it will read file names
from stdin.
Example:
rar a -x@exlist.txt arch *.exe
-y
-z[f]
Read archive comment from file <f>. Use with -sc switch
if you need to specify the character set for comment text file.
If <f> is not specified, comment is read from stdin.
Limitations
~~~~~~~~~~~
Command limitations:
Commands 'd','u','f','c','cf' will not operate with archive volumes.
Command 'a' cannot be used to update an archive volume, only to
create a new one.
Exit values
~~~~~~~~~~~
RAR exits with a zero code (0) in case of successful operation.
Non-zero exit code indicates some kind of error:
Code
0
1
2
3
4
5
6
7
8
9
10
11
255
Description
Successful operation.
Non fatal error(s) occurred.
A fatal error occurred.
Invalid checksum. Data is damaged.
Attempt to modify an archive locked by 'k' command.
Write error.
File open error.
Wrong command line option.
Not enough memory.
File create error
No files matching the specified mask and options were found.
Wrong password.
User stopped the process.
Glossary
~~~~~~~~
Archive
Volume
Copyrights
(c) 1993-2013 Alexander Roshal