I'm trying to create one Zip-file which contains everything in that directory (files & folders) and that preserves the directory structure.
By looking around on the net I see that lots of people have issues with this. So to make it easy on myself I installed the modules from pscx
which contain the CmdLet Write-Zip
.
Folder structure
- S:\TopFolder
- S:\TopFolder\Folder1
- S:\TopFolder\Folder1\SubFolder1
- S:\TopFolder\Folder1\SubFolder1\Stuff1.txt
- S:\TopFolder\Folder2
- S:\TopFolder\Folder2\SubFolder2
- S:\TopFolder\Folder2\SubFolder2\Stuff2.txt
Tested code
$Test = Get-ChildItem -Recurse 'S:\TopFolder\*'
Write-Zip -Path $Test -OutputPath 'S:\Zippie.zip' -IncludeEmptyDirectories
$Test = Get-ChildItem -Recurse 'S:\TopFolder'
Write-Zip -Path $Test -OutputPath 'S:\Zippie.zip' -IncludeEmptyDirectories
Result in 'Zippie.zip'
SubFolder1
SubFolder1\Stuff1.txt
SubFolder2
SubFolder2\Stuff2.txt
As you can see it's not sticking to the correct folder structure as Folder1
and Folder2
are missing. Is there something obvious I'm missing here? Because this issue has been reported as fixed and verified.
Thank you for your help.