Showing posts with label WinRAR. Show all posts
Showing posts with label WinRAR. Show all posts

Friday, January 31, 2014

WinRAR : RAR versus ZIP

WinRAR is able to create archives in two different formats: RAR and ZIP. Here is a comparison of these formats:

ZIP archives

The main advantage of ZIP format is its popularity. For example, most archives on Internet are ZIP archives. So if you are going to send an archive to somebody, but you are not sure that your addressee has WinRAR to extract the archive contents, it might be a good idea to use the ZIP format. Though, you may also send a self-extracting archive. Such archives are slightly larger, but can be extracted without external programs.

Another ZIP advantage is speed. ZIP archives are usually created faster than RAR.

RAR archives

Typically RAR format provides better compression than ZIP, especially in the solid mode. WinRAR multi-volume archives in RAR format allow more functions like self-extracting volumes.

RAR format has also a few important features missing in ZIP, such as the recovery record allowing to reconstruct damaged data and locking important archives to prevent their accidental modification.

Both RAR and ZIP formats are able to handle files of practically unlimited size (up to 8,589,934,591 GB).

Tutorial archiving files from the command line with WinRAR

The common command line syntax for archiving files is:

WinRAR A [ -switches ] <Archive> [ Files ] [ @File lists ]

For example, if you wish add the file LETTER.TXT to the archive LETTERS.RAR, type:

WinRAR A LETTERS.RAR LETTER.TXT

If an archive extension is not specified, WinRAR will use the default archive format selected in the default compression profile, but you may override it by specifying either .RAR or .ZIP extension.

The next example: add all *.WAV files to the solid RAR archive Songs:

WinRAR A -S Songs.RAR *.WAV

It is also possible to list the files to be archived in a file, rather than listing them in the command line. In this case the name of text file, containing the list of files to be archived, must be given in the command line. This is indicated by placing the symbol @ before this file name. Thus, you can create a file Binaries, containing the strings *.exe and *.com and execute the command:

WinRAR A TOOLS.ZIP @Binaries

to add all files with .EXE and .COM extensions from the current folder to ZIP archive TOOLS.

Window containing statistics is displayed during the archiving process. If you wish to break archiving, click on "Cancel" button in the command window. You may press "Background" button in this window to minimize WinRAR to the tray. If archiving is completed without problems, WinRAR terminates. Diagnostic message window is displayed in case of error.

See Command-line interface for detailed descriptions of commands and switches.

How to archiving files from the WinRAR shell

First, you need to run WinRAR. Double-click or press Enter on the WinRAR icon. You can also start it from the Windows "Start menu": enter "Programs" then "WinRAR" and then run the "WinRAR" item.

When WinRAR is running, it displays a list of files and folders in the current folder. You need to go to the folder, which contains files to archive. You may use Ctrl+D, the disks list below the toolbar or click on the small disk icon in the bottom left corner, to change the current disk. Press BS, Ctrl+PgUp, small "Up" button below the toolbar or double-click on the folder named ".." to go to the parent folder. Press Enter, Ctrl+PgDn or double-click on any other folder to enter that folder. Ctrl+\ will set the root disk or archive folder as the current folder.

When you have entered the folder with the desired files, select the files and folders, which you are going to archive. This may be achieved by using Shift + arrow keys or the mouse as in Windows Explorer and other Windows programs. It is also possible, in WinRAR, to select files using Space or Ins keys. "Gray +" and "Gray -" keys on the numeric keypad allow the selection of groups of files using file masks.

Having selected one or more files, click on the Add button at the top of the WinRAR window, press Alt+A or select the "Add files to archive" command in the Commands menu. Enter the destination archive name in the dialog box which appears or simply accept the default name. You may select, in this dialog, the format of the new archive ( RAR or ZIP), compression level, volume size and other archiving parameters. This dialog described in details in Archive name and parameters dialog topic. Click on the OK button when you are ready to create the archive.

During the archiving process, a window will be displayed showing operation statistics. If you wish to break the archiving process, click on the Cancel button in the command window. You may press the "Background" button in this window to minimize WinRAR to the tray. When archiving is completed, the command window disappears and the newly created archive becomes the currently selected file.

It is also possible to add files, to an existing RAR archive, using drag-and-drop. Select the desired archive in the WinRAR window and press Enter (or double click) on its name. RAR will read the archive and display its contents. You may now add files to the archive by simply dragging them from another program and dropping to WinRAR.

WinRAR Quick start: extracting files from the command line

Common command line syntax to extract files with full paths:

WinRAR X [ -switches ] <Archive> [ Files ] [ @File lists ] [ Destination folder\ ]

To extract files, ignoring paths:

WinRAR E [ -switches ] <Archive> [ Files ] [ @File lists ] [ Destination folder\ ]

For example if you wish extract the file LETTER.TXT to the current folder from the archive LETTERS.RAR, use the following command:

WinRAR X LETTERS.RAR LETTER.TXT

Archive extension is optional and may be omitted.

The next command extracts all *.WAV files from the archive Songs to the folder Audio:

WinRAR X Songs *.WAV Audio\

It is also possible to list the files to be extracted in a file, rather than listing them in the command line. In this case the name of text file, containing the list of files to be extracted, must be given in the command line. This is indicated by placing the symbol @ before this file name. Thus, you can create a file Binaries, containing the strings *.exe and *.com and execute the command:

WinRAR X TOOLS @Binaries

to extract all files with EXE and COM extensions from the archive TOOLS to the current folder.

Window containing statistics is displayed during the extraction process. If you wish to break extraction, click on "Cancel" button in the command window. You may press "Background" button in this window to minimize WinRAR to the tray. If extraction is completed without problems, WinRAR terminates. Diagnostic message window is displayed in case of error.

See Command-line interface for detailed commands and switches description.

WinRAR Command line syntax

It is possible to perform WinRAR commands from the command line. Common command line syntax is described below:

WinRAR <command> -<switch1> -<switchN> <archive> <files...> <@listfiles...> <path_to_extract\>

Command Character combination specifying the function to be performed by WinRAR. See the list of WinRAR commands here.
Switch Switches are used to define a specific type of operation, compression strength, type of archive, etc. See the list of WinRAR switches here.
Archive The name of the archive to process.
Files The name(s) of files to be processed.
Listfiles Listfiles are plain text files that contain names of files to process. File names should start at the first column. It is possible to put comments to the listfile after // characters. For example, you may create backup.lst containing the following strings:

c:\work\doc\*.txt//backup text documents

c:\work\image\*.bmp//backup pictures

c:\work\misc

and then run:

winrar a backup @backup.lst

You may specify both usual file names and list files in the same command line.

Path_to_extract Used only with commands e and x, indicating the folder in which to place extracted files. If this folder does not exist, it will be created.

 

Notes

a) If neither files nor listfiles are specified, then *.* is implied and WinRAR will process all files;

b) If archive extension is not specified when creating an archive, WinRAR will use the default archive format selected in the default compression profile, but you may override it by specifying either .rar or .zip extension.

If no archive extension is specified when extracting, WinRAR assumes .rar, so * means all archives with .rar extension. If you need to process all archives without extension, use *. mask. *.* mask selects all files. You can use wildcards in archive name in most operations, such as extraction, test and many others, but wildcards are not allowed when archiving and deleting.

c) Switches entered on the command line override the same configuration settings;

d) For commands c, e, s, t, rr, k and x wildcards may be used in the archive name. Thus it is possible to process more than one archive with a single command. Moreover, if you specify -r switch with these commands, they will search for archives in subfolders;

e) Some commands and switches are applicable only to RAR archives, some both to RAR and ZIP and some to all archive formats. This is dependent upon the functionality provided by the archive format;

f) Commands and switches are not case sensitive, you may write them both in upper and in lower case;

g) If any component of command line contains spaces, enclose it to quotes.

Examples

  1. add the folder "c:\latest data" to archive Info.rar

WinRAR a Info.rar "c:\latest data"

  1. unpack the archive Info.rar to folder d:\data

WinRAR x Info.rar d:\data\