I am trying to figure out how to create a zip file for each subfolder containing only files that match my criteria.
For instance I have:
Folder1
Folder2
Folder3
Each folder contains the same set of files but the filenames in each are slightly different, but the extensions are always the same. I would like to zip the .shp, .shx, .qpj, .prj and .dbf in each folder. Each folder would be its own zip file. I would rather not store the actual folder name other than as the name of the zip file.
I have tried:
find . -type d | xargs -I {} zip -r {}.zip {}
This creates each zip file but would zip every file not just the ones with the extensions I would like, it also stores the folder name in the zip.
find . -type d | xargs -I {} zip -r {}.zip {}'/'*.shp {}'/'*.shx {}'/'*.dbf {}'/'*.prj {}'/'*.qpj
The above does nothing other than gives errors that there is nothing to do.
Hopefully my poor attempts give a better idea of what I'm trying to do.
Any help appreciated.