-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextract zip.ps1
29 lines (22 loc) · 1023 Bytes
/
extract zip.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Define the source folder containing the ZIP files
$sourceFolder = "F:\OOOOO\man"
# Define the destination folder where the files will be extracted
$destinationFolder = "F:\OOOOO\man\00"
# Create the destination folder if it doesn't exist
if (!(Test-Path $destinationFolder)) {
New-Item -ItemType Directory -Path $destinationFolder
}
# Get all ZIP files in the source folder
$zipFiles = Get-ChildItem -Path $sourceFolder -Filter "*.zip"
# Loop through each ZIP file and extract it to the destination folder
foreach ($zipFile in $zipFiles) {
$zipPath = $zipFile.FullName
$extractPath = Join-Path $destinationFolder -ChildPath $zipFile.BaseName
# Create a folder for each zip file if you want to extract into individual folders
if (!(Test-Path $extractPath)) {
New-Item -ItemType Directory -Path $extractPath
}
# Extract the ZIP file
Expand-Archive -Path $zipPath -DestinationPath $extractPath -Force
}
Write-Output "Extraction completed!"