Thank you. I decided to bulk unarc all the mbug disks. So asked Grok for a powershell script. All good except it got the syntax back to front for the actual file extraction to subdirectories. (Grok may not be good at everything but sure can spit out code that works)
GROK: Thanks for the clarification on the IZArc command-line syntax. Here's the adjusted PowerShell script to extract files from mbug001.arc to mbug186.arc in A:\mbee, using .\IZARCe.exe -d -p"$extractDir" $archiveFile:powershell
_______________________________________________________________________________________________
# PowerShell script to extract files from mbug001.arc to mbug186.arc using IZArc command-line tool
# Assumes IZARCe.exe is in the same directory as the script
# Extracts each archive to a subfolder in A:\mbee (e.g., A:\mbee\mbug001\)
# Set the source directory
$sourceDir = "A:\mbee"
# Loop from 1 to 186
for ($i = 1; $i -le 186; $i++) {
$archiveNumber = "{0:D3}" -f $i # Format as 001, 002, ..., 186
$archiveFile = "mbug$archiveNumber.arc"
$fullArchivePath = Join-Path -Path $sourceDir -ChildPath $archiveFile
# Check if the archive file exists
if (Test-Path -Path $fullArchivePath) {
$extractDir = Join-Path -Path $sourceDir -ChildPath "mbug$archiveNumber" # Extract to subfolder
# Create extract directory if it doesn't exist
if (-not (Test-Path -Path $extractDir)) {
New-Item -ItemType Directory -Path $extractDir | Out-Null
}
Write-Host "Extracting $archiveFile to $extractDir..."
# Run IZArc command-line extraction
& .\IZARCe.exe -d -p"$extractDir" "$fullArchivePath"
if ($LASTEXITCODE -eq 0) {
Write-Host "Successfully extracted $archiveFile" -ForegroundColor Green
} else {
Write-Host "Failed to extract $archiveFile (Exit code: $LASTEXITCODE)" -ForegroundColor Red
}
} else {
Write-Host "Archive file $archiveFile not found in $sourceDir, skipping..." -ForegroundColor Yellow
}
}
Write-Host "Extraction process completed for all files."
Pause
_____________________________________________________________________
Using powershell saved a lot of time compared to unpacking each arc file separately.
GROK: Thanks for the clarification on the IZArc command-line syntax. Here's the adjusted PowerShell script to extract files from mbug001.arc to mbug186.arc in A:\mbee, using .\IZARCe.exe -d -p"$extractDir" $archiveFile:powershell
_______________________________________________________________________________________________
# PowerShell script to extract files from mbug001.arc to mbug186.arc using IZArc command-line tool
# Assumes IZARCe.exe is in the same directory as the script
# Extracts each archive to a subfolder in A:\mbee (e.g., A:\mbee\mbug001\)
# Set the source directory
$sourceDir = "A:\mbee"
# Loop from 1 to 186
for ($i = 1; $i -le 186; $i++) {
$archiveNumber = "{0:D3}" -f $i # Format as 001, 002, ..., 186
$archiveFile = "mbug$archiveNumber.arc"
$fullArchivePath = Join-Path -Path $sourceDir -ChildPath $archiveFile
# Check if the archive file exists
if (Test-Path -Path $fullArchivePath) {
$extractDir = Join-Path -Path $sourceDir -ChildPath "mbug$archiveNumber" # Extract to subfolder
# Create extract directory if it doesn't exist
if (-not (Test-Path -Path $extractDir)) {
New-Item -ItemType Directory -Path $extractDir | Out-Null
}
Write-Host "Extracting $archiveFile to $extractDir..."
# Run IZArc command-line extraction
& .\IZARCe.exe -d -p"$extractDir" "$fullArchivePath"
if ($LASTEXITCODE -eq 0) {
Write-Host "Successfully extracted $archiveFile" -ForegroundColor Green
} else {
Write-Host "Failed to extract $archiveFile (Exit code: $LASTEXITCODE)" -ForegroundColor Red
}
} else {
Write-Host "Archive file $archiveFile not found in $sourceDir, skipping..." -ForegroundColor Yellow
}
}
Write-Host "Extraction process completed for all files."
Pause
_____________________________________________________________________
Using powershell saved a lot of time compared to unpacking each arc file separately.
