I have multiple .QGS files and I would like to export them to .QGZ.
Right now I'm opening the .QGS file and save as .QGZ one by one, but I have over 180 .QGS files so I'm looking for a way to automate it.
I am using QGIS 3.30 and Windows 10 if that matters, but I could set up a virtual machine with Linux if that helps.
I was able to solve it with the following Powershell commands:
##copying .qgs to another directory
cp *.qgs ..\dir\
##changing to that dir
cd ..\dir\
##zipping .qgs
Get-ChildItem -Filter *.qgs | ForEach-Object { Compress-Archive -Path $_.FullName -CompressionLevel Optimal -DestinationPath ($_.FullName + ".zip") }
##Changing the extension from .zip to .qgz
dir | rename-item -NewName {$_.name -replace ".qgs.zip",".qgz"}
##Deleting everything that's not -qgz
Get-ChildItem | Where-Object { $_.Extension -ne ".qgz" } | Remove-Item