When downloading from the internet (example from Torrents), you might have a lot of directories with rar files. Some sources provide most to all of their content archived in single or multiple rar files. Usually someone extracts those files immediately after download, but sometimes you can get lost in the amounts of directories and lose track of which folders/directories have rar files that were not yet extracted.

Eventually, and when you are done seeding you will want to delete those files as they just take up extra space.

Recursive Search Thru Dirs to List All Unextracted Files

Using this bash command (works in linux/cygwin/wsl/unix/mac) you can find out which of your subdirectories have unextracted rars.

First create this script ListUnextractedRARs.sh. I just have this in my downloads directory, as thats my common place to run it from. However you can put it in your $PATH so that you can call it easily from any path. This works because script looks for unextracted rars in the current working directory. Make sure its executable by its permissions.

# shows rar files that have yet to be extracted by looking thru all of the rars files' subfolders for video files (which I assume are none rar,r#,r##,r###,nfo,sfv)
/usr/bin/find . | grep rar | while read i; do DNAME=`dirname $i`; COUNT=$(/usr/bin/find "$DNAME" -type f | grep -c -Ev --color  "\.rar$|\.r[0-9]+$|\.nfo$|\.sfv$"); echo "$COUNT - $i"; done | grep "^0"

Now run that script

$ cd ~/Downloads
$ ./ListUnextractedRARS.sh
0 - ./AwesomeTools/Tools.rar

So from this output, we know that AwesomeTools has an unextracted rar/rars files.

Deleting Rar Files

After you are done seeding and extracting those rars. You will want to make space. You can do that with bash commands. Personally, I look to use a visual tool that gives alot of information.

Step 1. Download WizTree

Step 2. Open WizTree and have it scan your download directory.

Once the app is open click on the “Select:” dropdown box, select your drive or download directory and press Scan

Step 3. Change view from “Tree View” to “File View” (its a tab selector at the top)

Step 4. In the “File Search Filter” put the following: *.r??

Another option is to filter by chunks: So first filer for *.rar and then for *.r0? or *.r0* and then for *.r1? or *.r1* and so on until *.r9? or *.r9*

Step 5. Look thru the results and make sure its only rar and their part files that you are seeing. You do not want to accidentally delete something that you need.

Notice at the bottom it will tell you how many files it found of that type and the size.

Step 6. Delete the files.

You can select all of the files and delete. If you have a slow HDD this might not work and you might need to delete 10 to 20 at a time. You can use the keyboard to Shift arrow and then delete.

Once they delete they cross out with red text.

Leave a Reply

Your email address will not be published. Required fields are marked *