Last active
May 3, 2021 13:27
-
-
Save elisim/fa0347b9fcaee402bf8071c0642a4383 to your computer and use it in GitHub Desktop.
Powershell script to unrar RAR files in a directory a given destination
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# # This script will unrar the RARs in $src to $dest. Based on: | |
# https://serverfault.com/questions/356184/powershell-unrar-with-wildcard/356208?newreg=44a1363382a04e7a95a915434574dec2 | |
param ( | |
[Parameter(Mandatory=$true)][string]$src, | |
[Parameter(Mandatory=$true)][string]$dest | |
) | |
$files = @() | |
Get-ChildItem $src -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:\"Program Files"\WinRAR\unrar x -y $f $dest | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment