This guide describes the use of the WinRAR command-line tools (v5.01) for compressing and uncompressing files in a directory and their use in batch files (for IZArc and 7-zip, see this post). This guide is an extension of a previous post, Automate Zipping Tasks using the Command-line Interface that explained the use of the command-line tools for two free compression utilities, IZArc and 7-Zip. The information in this guide was tested on a Windows PC running Vista.
WinRAR is a popular and powerful archive manager that can be used from the command-line or with scripting languages such as batch files. It includes two command-line tools, rar.exe and unrar.exe, where rar.exe compresses and unrar.exe uncompresses files. Both are located in the “C:Program FilesWinRAR” folder in the installable version. Although WinRAR is shareware, it can be used on a trial basis for 40 days. Using WinRAR’s command-line tools is similar to those for IZArc and 7-Zip. The syntax for using the WinRAR executables is:
That file has to be lowercase because the BBS program I'm using ignores the FILEID.DIZ as a description since it is uppercase. If I manually change it to lowercase, the description is imported successfully. I know that rar has a renaming switch, but then I'd have to batch convert all of the zip files to rar, and then back to zip. NOTE: When you complete the preceding steps, the highlighted state of all files except one disappears, so it may appear as if you are only renaming one file. However, after you press ENTER, all of the files are renamed. When you rename multiple files, all of the renamed files have the same name with a number in parentheses appended to the name. Steps to change file names: Step1: Open the RAR file in WinRAR application. Step2: Right-click any file or folder name and select “Rename” option. Step3: Type a shorter name and press “Enter”. Initially choose higher level folders to rename before renaming its subfolders and files. Doing this so, potentially renames multiple file paths. Multiple file renaming options are available with File Renamer, enabling it’s user to number files, find and replace words numbers or characters in files, add characters to the file names and more. File Renamer – Rename Multiple Files at Once. ReNamer is a very powerful and flexible file renaming tool, which offers all the standard renaming procedures, including prefixes, suffixes, replacements, case changes, as well as removing contents of brackets, adding number sequences, changing file extensions, etc. For advanced users, there is a.
To get a listing of the options for the rar and unrar commands, open a command window, cd to the WinRAR directory, and type rar or unrar and then press enter (rar /? or rar help may also be used, use rar >rar_cmds.txt or unrar >unrar_cmds.txt to print the command options to a file). For more detailed information, open the rar.txt file in the WinRAR directory which contains the RAR console version user’s manual.
Examples to compress a folder:
creates archive yourfiles.rar and compresses all .txt files in the current folder
creates archive yourfiles.rar in C:yourfolder and compresses all .txt files in the current folder and its subfolders
creates archive yourfiles.rar in C:yourfolder and compresses all .txt files in otherfolder and its subfolders
creates archive yourfiles.rar and compresses all files in the current folder, but doesn’t include subfolders (note lack of extension; WinRAR will use the default extension .rar)
“a” command. Adds to the archive
“-r” switch. Recurses subfolders
Renaming Multiple Files In File Explorer
Examples to uncompress a folder:
extracts all *.gif files from yourfile.rar to c:extractfolder (trailing backslash required) and restores the folder structure
extracts all files in c:yourfile.rar to the current folder (folder structure ignored)
“x” command. Extracts with full paths
“e” command. Extracts and ignores paths
Compression example using Multiple Switches:
compresses all new or updated files from c:test and its subfolders to e_archive.rar, deletes the files after they are added to the archive, and excludes any files with a “bat” extension,
“a” command adds to the archive
“-r” switch. Recurses subfolders
Renaming Multiple Rar Files Free
“-ep” switch. Adds files to the archive without including the path information. Multiple can exist in the archive with the same name.
“-u” switch. Equivalent to the “u” command when combined with the “a” command. Adds new files and updates older versions of the files already in the archive
“-df” switch. Deletes files after they are moved to the archive
“-x” switch. Excludes the specified file(s) from the operation
Basic rules for WinRAR:
- When files or listfiles are not specified, all files in the current folder are processed
- When specifying all files in a folder, yourfolder or yourfolder*.* are equivalent
- Folder structures are automatically saved in archives (but not automatically extracted)
- WinRAR uses the .rar extension by default, but that can be overridden by specifying the zip extension in the archive name
- Switches and commands are not case sensitive and can be written in either upper or lower case
Another point is that WinRAR doesn’t appear to install to the Windows path environment variable, so it must be specified either at a command prompt, set permanently in the environment variable settings, or specified in a batch file (WinRAR v3.71.0.0 was used for this guide and that may not be the case for all versions).
To set the Windows path environment variable temporarily at a command prompt or in a batch file, use the following command:
To set it permanently in the Windows path for your PC:
start–>Control Panel–>System–>Advanced system settings–>Advanced Tab–>Environment Variables–>System Variables–>Path–>Edit. Add the path ;C:Program FilesWinRAR; to the end (don’t forget the single semicolons at the beginning and end). Hit OK three times.
Using WinRAR in Batch Files:
Two batch file examples are provided below, The uncompress_rar.bat file decompresses all .rar files from a folder and places the extracted files into another directory.
The compress_rar_rev2.bat file provides the following compression options for a user specified directory. Option 4 is the most commonly used structure and the most appropriate option in most cases:
- Compress files in dir individually (no subdirs)
- Compress files in dir and subdirs individually – no paths
- Compress all files in dir into a single archive (no subdirs)
- Compress all files in dir and subdirs into a single archive
- Compress all files in dir and subdirs into a single archive – no paths
Be sure to change the extension(s) to .bat before using either file and edit the folder paths as required. Both of the following batch files temporarily set the Windows path environment variable for the WinRAR application folder when executed.
Batch file downloads:
If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.
Renaming Multiple Rar Files Windows 10
IN THIS TASK
Summary
This step-by-step article describes how to use Windows Explorer to rename multiple files in Windows XP.
How to Rename Multiple Files with Windows Explorer
How To Batch Rename Files
Start Windows Explorer. To do so, click Start, point to All Programs, point to Accessories, and then click Windows Explorer.
Select multiple files in a folder. To do so, press and hold down the CTRL key while you are clicking files.
After you select the files, press F2.
Type the new name, and then press ENTER.
NOTE: When you complete the preceding steps, the highlighted state of all files except one disappears, so it may appear as if you are only renaming one file. However, after you press ENTER, all of the files are renamed. When you rename multiple files, all of the renamed files have the same name with a number in parentheses appended to the name to make the new file name unique. For example, if you type BUDGET as the new name, the first file is named BUDGET. All of the remaining selected files are named BUDGET(x), where x is a unique number, starting with (1).
Renaming Multiple Rar Files Mac
Notes
If you make a mistake when you try to rename multiple files, you can press CTRL+Z, or click Undo Rename on the Edit menu to undo file rename action you just completed, and you can repeat this process as needed.
The Rename function in Windows Explorer does not match the behavior of the REN command you may use at a command prompt. For example, if you had files that are named smitha.doc, smithb.doc, and smithc.doc, you could use the ren smith*.doc smythe*.doc command. All file names automatically show the new spelling, and are renamed smythea.doc, smytheb.doc, and smythec.doc.
If you use the Windows XP Rename function in Windows Explorer, after you select the three 'smith' files, and rename smitha.doc to smythea.doc, all the other files you selected are named smythea(x).doc. To return to the original file name structure (the use of a, b, c, etc), you must rename each file individually.