Is storage a potential issue? Think you are also concerned about organization of the course backups (good thinking, cause you might have to use one of those backups to restore so the storage of those by category name would make them easier to find).
Space: running Linux? Got a Google edu?
Create a Google Bucket - mine is 1P ... pentabyte.
Mount the bucket on your moodle server: /mnt/gbucket
In the bucket create short-named directories that represent categories: example: ushistory
Query the DB for all the course id's of that ushistory category and export that to a ushistorycids.txt file in code/admin/cli/
That file contains one liners of each course ID in ushistory category.
Now create a bash shell script that loops through the ushistory course ID numbers for backing up those courses and point the finished backup to your bucket's ushistory.
example:
ushistcids.txt
383
546
169
342
384
278
375
440
Looping script ushistbackups located in code/admin/cli/ (moosh requires execution of commands to be in moodle code directory)
#!/bin/bash
#
cd /var/www/html/admin/cli/;
for i in `cat /var/www/html/admin/cli/ushistcids.txt`
do
echo "Course ID in que:" $i;
php backup.php --courseid=$i --destination=/mnt/gbucket/ushistory/
done
ls -l /mnt/gbucket/ushistory/;
echo 'Done!';
When Moodle creates a backup /moodledata/temp/backups/ will be used to build the .mbz backup files. Last operation of the backup is to copy the backup.mbz file in that temp directory to destination. This to say that drive usage will increase a bit.
When the backup process has finished, it should clean up temp backups area ... cron does have task list that also do that.
First run of such a thing needs to be monitored to see if there are any un-intended consequences!
Yes, you have multiple scripts for each category this way ... if you are a better programmer than me ... many are .. you could reduce the number of scripts am sure.
'SoS', Ken