Extract All Files Of Type To Same Named Dir
Description:
This script uses 7-Zip, and will extract all files of the given type into their own folder of the same name. This is useful, for example, when needing to bulk extract EXE files or bulk extract zip files at one time into their own individual directories.
Language:
PowerShell
Usage Type:
Standalone
Script Source:
################################################### # ExtractAllFilesOfTypeToSameNamedDir.ps1 # Script By Sean Huggans # Original Date: 2016.10.9 # # This Script Requires 7-Zip to be installed. ################################################### # Change this to the current path of 7-Zip if needed $7ZipPath = "C:\Program Files\7-zip\7z.exe" # Change this to the file extension you want extracted $ExtensionToUnzip = "exe" # Change this to your source directory $SourceDir = "C:\Temp\DriverBuild" $ZippedFiles = Get-ChildItem -Path $SourceDir | Where-Object {$_.Extension -Match $ExtensionToUnzip} foreach ($ZippedFile in $ZippedFiles) { $DestDir = "$SourceDir\$($ZippedFile.Name.Replace(".$($ExtensiontoUnzip)",''))" echo $ZippedFile.FullName &$7ZipPath x $ZippedFile.Fullname "-o$DestDir" -y }
Note: that all applications posted here are posted for use, both commercial and non-commercial, free of charge, and as such are provided as-is, without warranty of any kind whatsoever. visuaFUSION, FMSCUG or any other program listed here's author are not responsible for any damages or shortcomings that result from usage of any of these applications.