quickie ... so there might be some typos and corrections below. Once xferred 4000 courses from old server to new server and had them restored to categories (the restore piece to this with moosh not shared here) in about 4 hours.
On old server.
Set backup preferences as desired (no user etc.)
Automated backups if they are working to a designated directory outside of
moodledata ... where ever you have plenty of space.
OR
to make it easier to rebuild on the new server:
use admin/cli/backup.php (still set backup preferences) to loop through a listing
of course ID's for a category of courses and have that backup.php script
save to a designated directory outside of Moodle only to a category directory.
Category: Academic
Course ID's 32.4.7.2.43.6
File containing CIDS ... acadcids10.txt .. one CID per line
script
/srv/www/moodle/admin/cli# cat niclbackupsacad
#!/bin/bash
#
# echo $1;
cd /srv/www/moodle/admin/cli/;
for i in `cat /srv/www/moodle/admin/cli/acadcids10.txt`
do
echo "Course ID in que:" $i;
php backup.php --courseid=$i --destination=/srv/backups/acad/
done
ls -l /srv/backups/acad/;
echo 'Done!';
So one ends up with something like this:
-rw-r--r-- 1 root root 267259 Dec 16 2017 backup-moodle2-course-117-varsity_softball-20171216-0749-nu.mbz
-rw-r--r-- 1 root root 3715363 Dec 16 2017 backup-moodle2-course-1303-service-learning_center-20171216-0759-nu.mbz
-rw-r--r-- 1 root root 108147 Dec 16 2017 backup-moodle2-course-1309-social_work_junior_field_placement-20171216-0759-nu.mbz
-rw-r--r-- 1 root root 2675418 Dec 16 2017 backup-moodle2-course-1552-commdptadv-20171216-0717-nu.mbz
-rw-r--r-- 1 root root 47626 Dec 16 2017 backup-moodle2-course-2230-hpsd-20171216-0727-nu.mbz
now create a file that provides a listing of just. the backup file:
acadfiles.txt
Looks like:
backup-moodle2-course-3815-comm413.01.f17-20171216-0718-nu.mbz
backup-moodle2-course-3816-comm218250.01.f17-20171216-0718-nu.mbz
backup-moodle2-course-3817-comm292.01.f17-20171216-0718-nu.mbz
backup-moodle2-course-3819-psyc326.01.f17-20171216-0756-nu.mbz
backup-moodle2-course-3821-chem477.01.f17-20171216-0753-nu.mbz
backup-moodle2-course-3822-chemphys490.01.f17-20171216-0753-nu.mbz
backup-moodle2-course-3823-chem108.01.f17-20171216-0753-nu.mbz
backup-moodle2-course-3825-chem101.02.f17-20171216-0754-nu.mbz
backup-moodle2-course-3827-mathcpsc490.01.f17-20171216-0731-nu.mbz
make a symlink from web root of old server to the location of these backups ... you'll remove the symlink later
ln -fs /srv/backups/acad acadbackups
URL then would be: https://oldserver/acadbackups/
Go to new server ...
create a file system repo in moodledata/reposository called 'acad'
cd acad
wget http://oldserver/acadbackups/acadfiles.txt
That acquires the file listing.
Edit the file listing (acadfiles.txt) and add the URL to teh front of each file in the listing.
Line one above would now look like:
http://oldserver/acadbackups/backup-moodle2-course-3815-comm413.01.f17-20171216-0718-nu.mbz
Do that for every course backup listed in that file.
Once that's done, use wget to get them all:
wget -i acadfiles.txt
Each backup file will be transferred to the where you are located ...
moodledata/repostiory/acad/
Change ownerships permissions to allow Moodle to see 'acad' and all the backup files therein.
Go to the new Moodle and to a course that has file system repo turned on and pointed to 'acad'.
Restore.
Or check out moosh and the command to restore a course to a category by category ID.
'spirit of sharing, Ken