Skip to main content
deleted 579 characters in body
Source Link
pfrud
  • 81
  • 7

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

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

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.

edited body; edited title
Source Link
Kadir Şahbaz
  • 78k
  • 57
  • 257
  • 404

Batch export .qgsQGS to .qgz (QGIS)QGZ

I have multiple .qgsQGS files and I would like to export them to .qgzQGZ.

Right now I'm opening the .qgsQGS file and save as .qgzQGZ one by one, but I have over 180 .qgsQGS 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

Batch export .qgs to .qgz (QGIS)

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

Batch export .QGS to .QGZ

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
Explained how I solved it.
Source Link
pfrud
  • 81
  • 7

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

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 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
deleted 20 characters in body
Source Link
Noura
  • 3.4k
  • 3
  • 20
  • 41
Loading
Source Link
pfrud
  • 81
  • 7
Loading