Maximum PC

It is currently Tue May 05, 2015 3:28 am

All times are UTC - 8 hours

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: WinRAR script
PostPosted: Tue Oct 19, 2004 6:25 pm 

Joined: Tue Oct 19, 2004 3:38 am
Posts: 3
Location: San Jose, CA U.S.A.
Will WinRAR run text scripts that allow me to archive many files in an automated fashion? If so, can someone help, or point me in the right direction?



 Post subject: Re: WinRAR script
PostPosted: Tue Oct 19, 2004 6:56 pm 
Notched on both sides
Notched on both sides
User avatar

Joined: Fri Oct 15, 2004 12:42 pm
Posts: 2765
Location: GTW d- s+:+ a C++++ K+++ w++++
M3g4d37h wrote:
Will WinRAR run text scripts that allow me to archive many files in an automated fashion? If so, can someone help, or point me in the right direction?



Hey M3,
Yup you can create batch files to do what you want because WinRAR supports command line options....

However... the info is REALLY huge... So I'm Warning you up front be prepared for a Message with a Verbosity of 9 on this message <grin>


An examlple command line syntax for WinRAR would be:

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

The <command> part denotes a character combination that tells WinRAR what you want to do (add files, extract, etc.)

The -<switch> part denotes the use of switches which are used to define a WinRAR options like compression strength, if you want a ZIP or RAR, etc.

the <archive> is what you want the acrhive to be named... or which archive you are using to get files from...

the <files...> tag is basically The names of files to be processed.

The <@listfiles...> tag is cool because it allows for a seperate plain text file which contains names of the list of files to process.

and Path to extract is... well self-explanatory.

I'll attach a list of commands and switches at the end of this section, but first let me explain the use of @listfiles...

When using @listfiles:
Create a text file in notepad with the list of files you wish to have added to your archive. The best use for this is that you can create a batch file for the actual archiving process that you only have to edit the arcrhive name and @listfiles name, instead of creating some huge command line to run (since as you know you are limited on how long that list can be).

When creating the text file please remember that much like a simple text database file (if you will), that each file should be listed seperately, on its own line. Like this:

Its possible to add comments to the above list in the following manner:
filename1.doc //This is my resume
filename2.doc //this is my wife's real name
filename3.doc //this is a crazy long thread from mpc. :P

Also note that wildcards are acceptable...

Lets pretend that we've named our file @mybackup.lst

the command line to create an archive named mybackup would be:

winrar a mybackup @mybackup.lst

notice that I didn't use any switches in the above example...

NOTE: You can also specify both file names and list files in the same command line.

winrar a mybackup c:\docs\test2.doc @mybackup.lst

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.

a add files to an archive
c add an archive comment
d delete files from an archive
e extract files from an archive, ignoring paths
f freshen files within an archive
i find string in archives
k lock an archive
m move files and folders to an archive
r repair a damaged archive
rc reconstruct missing volumes
rn rename archived files
rr[N] add data recovery record
rv[N] create recovery volumes
s[name] convert an archive to a self-extracting type
s- remove SFX module
t test archive files
u update files within an archive
x extract files from an archive with full paths

-ac clear Archive attribute after compression or extraction
-ad append archive name to destination path
-af<type> specify archive format
-ag[format] generate archive name using the current date and time
-ao add files with Archive attribute set
-ap set path inside archive
-as synchronize archive contents
-av apply authenticity verification
-av- disable adding authenticity verification
-cfg- ignore default profile and environment variable
-cl convert file names to lower case
-cu convert file names to upper case
-df delete files after archiving
-dh open shared files
-ds do not sort archiving files
-ed do not add empty folders
-en do not add "end of archive" block
-ep exclude paths from names
-ep1 exclude base folder from names
-ep2 expand paths to full
-e<attr> set file exclude attributes
-f freshen files
-hp[pwd] encrypt both file data and headers
-ibck run WinRAR in background
-ieml send archive by email
-iicon<name> specify SFX icon
-ilog[name] log errors to file
-inul disable error messages
-ioff turn PC off
-k lock archive
-kb keep broken extracted files
-m<n> set compression method
-mc<par> set advanced compression parameters
-md<n> select dictionary size
-ms specify file types to store
-os save NTFS streams
-ow process file security information
-o+ overwrite existing files
-o- do not overwrite existing files
-p[pwd] set password
-r recurse subfolders
-r0 recurse subfolders for wildcard names only
-rr[N] add data recovery record
-rv[N] create recovery volumes
-s create a solid archive
-s<N> create solid groups using file count
-se create solid groups using file extension
-sfx[name] create self-extracting archive
-sv create independent solid volumes
-sv- create dependent solid volumes
-s- disable solid archiving
-t test files after archiving
-ta<date> process files modified after the specified date
-tb<date> process files modified before the specified date
-tk keep original archive time
-tl set archive time to newest file
-tn<time> process files newer than the specified time
-to<time> process files older than the specified time
-ts<m,c,a> save or restore file time (modification, creation, access)
-u update files
-v<n>[k|b|f|m|M|g|G] create volumes
-vd erase disk contents before creating volume
-ver file version control
-vn use the old style volume naming scheme
-vp pause before each volume
-x<file> exclude the specified file
-x@<listfile> exclude files using a specified list file
-y assume Yes on all queries
-z<file> read archive comment from file
-- stop switches scanning
Other Notes
If neither files nor listfiles are specified, then *.* is implied and WinRAR will process all files:
winrar a mybackup
the above command line would backup *.* in the directory it was run from.

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

Any switches entered on the command line WILL override GUI configuration settings

The commands c, e, s, t, rr, k and x allow for wildcards to 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

Some commands and switches are applicable only to RAR archives, while others are available to only RAR and ZIP. There are still others that are applicable to all archive formats. This is dependent upon the functionality provided by the archive format

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


Hope this info helps!!!!!

NOTE: For more complete info - you'd need the .hlp file from WinRAR - I used the Help file from WinRAR 3.3 Corp edition to answer your questions... I added extra information where I felt it needed clarification.

Are you Folding for a cure? Why not? Its easy, free, and doesn't hurt anyone - in fact it can only help!

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 8 hours

Who is online

Users browsing this forum: No registered users and 3 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

© 2014 Future US, Inc. All rights reserved.