This is working if you manually change the layer group name by editing line 7:
import datetime, os
out_folder = r'/home/bera/Desktop/tempgis/shapes/'
yearmonth = datetime.datetime.today().strftime('%y%m')
root = QgsProject.instance().layerTreeRoot()
subname = 'sub-group1' #Change this to the subgroupname
options = QgsVectorFileWriter.SaveVectorOptions()
options.driverName = "ESRI Shapefile"
for child in root.findGroup(subname).children():
if isinstance(child, QgsLayerTreeLayer): #For each layer, save as shapefile
print(child.name())
coordinateTransformContext=QgsProject.instance().transformContext()
options.ct = QgsCoordinateTransform(child.layer().crs(),QgsProject.instance().crs(), coordinateTransformContext)
out_file = os.path.join(out_folder, child.layer().name()+'_{}.shp'.format(yearmonth))
QgsVectorFileWriter.writeAsVectorFormatV2(child.layer(), out_file, coordinateTransformContext,
options)
