Hello All,
I haven’t quite got the hang of how to skip a directory or two while using the following code:
#-match is a regex, so you can do || which is OR #Using the OR || switch to unzip all files with .zip or .prd $files=gci $ScriptPath -recurse | where {$_.Extension -match "zip||prd"} foreach ($file in $files) { $source = $file.FullName #Join-Path is a standard Powershell cmdLet $destination = Join-Path (Split-Path -parent $file.FullName) $file.BaseName write-host -fore green $destination $destination = "-o" + $destination #Start-Process needs the path to the exe and then the arguments passed seperately. You #can also add -wait to have the process complete before moving to the next Start-Process -FilePath "C:\Program Files\7-Zip\7z.exe" -ArgumentList "x -y $source $destination" -Wait }
Right now, I’m having an issue with this section of code waiting for input for some zip archives that wants a password to extract. However, I simply do not need to extract the files in a directory called “Reports.”