Are you like me and have literally thousands of .rar archived material laying around on old disks?
It can be a pain in the lower region of the backside of your body to unrar all of those files without it being time consuming and boring as hell.
After some fiddlin’ around in PowerShell and some Googelin’, I created this script to do the job for me. It uses unrar.exe, a commande line based extract tool to do the job, and plases the files in a directory of your choice. Just run the script, and it unrars all the archives it finds under the parent folder.
Unrar.exe can be downloaded from here.
Remember to change the directory to unrar.exe if you choose a different install dir.
Please feel free to comment if you have some way of improving or simplifying the code.
– F
(Based on the script of this awesome guy)
$parent = 'c:temprar' $unrarred = 'c:tempunrar' $files = @() # Test to see if Unpackdir is present if ((Test-Path -Path $unrarred) -ne $true) # If not present, create Unpackdir {md C:Tempunrar} Get-ChildItem $parent -Recurse -Filter "*.rar" | % { # Recurse through all subfolders looking for .rar files only. $files = $files + $_.FullName } foreach ($f in $files) { # UnRAR the files. -y responds Yes to any queries UnRAR may have. C:unrarUnRAR.exe x -y $f $unrarred }