I have a folder structure that looks like this:
-Daily Logs
-Script1Logs
-AnotherScriptLogs
-ThirdScriptLogs
I would like to zip all the folders underneath "Daily Logs" and retain the same folder structure.
Is there a way to zip the folders in one shot without going through each one individually? Also, can the zip file include only the file structure shown above instead of the entire path to the log folders?
This is what I am using to zip the Daily Logs folder, but it does not zip the sub folders and it includes the entire path to the daily logs folder as part of the folder structure inside the zip file.
If (!(Test-Path $ARCHIVELOGFOLDER\$ARCHIVELOGFILE)) {
Write-Zip $file.FullName $ARCHIVELOGFOLDER\$ARCHIVELOGFILE
Write-Zip -Path $files -OutputPath $ArchiveFile -Append -FlattenPaths -IncludeEmptyDirectories -Quiet -Level 9
}