I'm currently trying to zip a huge amount of folders (~550) from my dataserver (Q:) to my Archive server (V:). The goal is to move all 550 selected folders to my V: Server while retaining the exact same folder structure. I want to do so using 7Zip's command line 7za since I've been told PowerShell's Compress-Archive is quite troublesome when it comes to big filesizes.
So my idea was to copy the entire folder structure of (Q:) to (V:) without copying any files. So that then I could simply zip to the exact same path with just a different drive letter. I already did this so now Q: and V: have the same folder trees.
$listPath = "Q:\SourceNEW.csv"
$homepath = "data\clients"
$list = import-csv $listPath -Encoding UTF8
$driveone = "Q:\"
$drivetwo = "V:\"
foreach ($user in $list) {
$pathA = Join-Path ($driveone + $homepath) -ChildPath $user.username #Q:\ + data\clients + \A\Aclient\Aproject
$pathB = Join-Path ($drivetwo + $homepath) -ChildPath $user.username #V:\ + data\clients + \A\Aclient\Aproject
$pathsplit = Split-Path -Path $pathB -Leaf
if (-not (Test-Path "$env:ProgramFiles\7-Zip\7z.exe")) {
throw "$env:ProgramFiles\7-Zip\7z.exe needed"
}
Set-Alias sz "$env:ProgramFiles\7-Zip\7z.exe"
sz a -an -mx=5 $PathB $PathA
}
This works as to copying the specified folders from Q: to V: as it only affects the files listed in the CSV. Now my problem is, that in adition to the final, sorted 7z files, 7Zip also creates a "__.7z" file sitting in "V:\" that is just the entierty of my Q: drive. What am I missing that zips up everyting twice?