mountain reflection on body of water

Elevating Archives: Zip to 7z Conversion Mastery

Streamlining Storage with PowerShell

In the digital age, efficient are paramount. This offers a seamless way to convert ZIP files to the more efficient 7z format, optimizing storage space and maintaining file integrity. Ideal for , it’s a tool that enhances your digital .

# Script Name: Archives - Zip to 7z Converter.ps1
# Author: Wesley Ellis
# Date: 2023-11-06
# Description: Converts ZIP files to 7z format in the current directory, then deletes the original ZIP files.

Write-Host "Starting conversion process..." -ForegroundColor Green
$7z_exe = "C:\Program Files\7-Zip\7z.exe"
if (-not (Test-Path $7z_exe)) {
    Write-Host "Error: 7-Zip not found at $7z_exe." -ForegroundColor Red
    exit
}
Get-ChildItem -Filter "*.zip" | ForEach-Object {
    $zipFile = $_.FullName
    $tempFolder = "$($_.BaseName)_tmp"
    $7zFile = "$PSScriptRoot\$($_.BaseName).7z"
    & $7z_exe x -y -o"$tempFolder" "$zipFile"
    & $7z_exe a -t7z "$7zFile" "$tempFolder\*"
    Remove-Item $zipFile, $tempFolder -Recurse -Force
}

To utilize this script, ensure is installed and the script is placed in the directory with your ZIP files. Running it will convert all ZIP files to 7z format and remove the originals, streamlining your process.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

WordPress Cookie Plugin by Real Cookie Banner