WinRAR Tip #3: Delete Multiple Files out of Multiple RAR Files

Wednesday, July 5, 2006
By: Matthew Doucette

WinRAR is a file compressor / archiver great for backing up data.  Download WinRAR at rarlab.com/download.htm.

 

WinRAR Tip #3: Delete Multiple Files out of Multiple RAR Files:

Use one of these convenient batch files:

Windows version WinRAR batch file:

REM Windows Version
for %%I in (*.rar) do "C:\Program Files\WinRAR\WinRAR.exe" d -ibck -pYOURPASSWORD "%%I" *.exe *.txt *.rar
pause

Command line version WinRAR batch file:

REM Command Line Version
for %%I in (*.rar) do "C:\Program Files\WinRAR\RAR.exe" d -ibck -pYOURPASSWORD "%%I" *.exe *.txt *.rar
pause

They delete all *.exe, *.txt, and *.rar files out of every RAR file in the same folder as the batch file, including those password protected with "YOURPASSWORD" as the password.  (Security tip:  Do not use "YOURPASSWORD" as your password!  Visit GRC's Ultra High Security Password Generator for tips on secure password generation.)

This batch file is only an example.  You must modify it to specifically suit your needs.

To create the batch file, copy the above quoted text into Notepad and save it as "delete.bat", (without quotes).  delete.bat will be your batch file.  Put delete.bat in the same folder as the RAR files.  (Always make backups before messing with your data.  I recommend doing testing in a folder away from your actual data using copies of your actual data.)

Batch file warning:  Double-clicking a batch file (.bat file) executes the batch file's commands, it does not open it for editing!  To open a batch file, you must right-click it and choose "edit".

The example batch file above will delete all *.exe, *.txt, and *.rar files from all RAR files found in the current folder that are password protected via the password "YOURPASSWORD".

Let me break down the batch file for you

Notice:  Xona.com holds no responsibility for any data loss you experience.  Make backups of your RAR files before you attempt to modify them, in case it does not work.  Double check your work.  If you have lots of RAR files, test the batch file on just a few of them (a few copies of them) first.  Do not delete files you are not one hundred percent certain you do not need.  Always make backups.

 

All WinRAR Tips:

 

Have Any Tips To Add?

If you have WinRAR tips you would like to add, please contact us.

 

Also See:

 

External Links:

 

 

About the Author: I am Matthew Doucette of Xona Games, an award-winning indie game studio that I founded with my twin brother. We make intensified arcade-style retro games. Our business, our games, our technology, and we as competitive gamers have won prestigious awards and received worldwide press. Our business has won $190,000 in contests. Our games have ranked from #1 in Canada to #1 in Japan, have become #1 best sellers in multiple countries, have won game contests, and have held 3 of the top 5 rated spots in Japan of all Xbox LIVE indie games. Our game engines have been awarded for technical excellence. And we, the developers, have placed #1 in competitive gaming competitions -- relating to the games we make. Read about our story, our awards, our games, and view our blog.