by Ken Task.
Modify as you see fit ... ;)
First, move all the courses to be archived to an 'archived' category. Can do
that via Moodle Admin UI. Hide all those courses. DB query below could add a variable for that category ID.
Manually create an archive directory on your largest partition ... for sake of example, let's say that's /home/.
mkdir /home/archive
*** The backup.php script will use the site settings for backups - Site Admin menu.
Scripts below ... replace [] with appropriate info
cd [/PATH/TO/MOODLECODE]/admin/cli/
nano to create the following scripts:
----
getcourseids
mysql -u root -p'[PASS]' -e "use [DB4MOODLE];select id from mdl_course where visible='0'"; > courseids.txt;cat courseids.txt
edit courseids.txt and remove the first line ... that's the column heading.
-----
niclbackups
#!/bin/bash
#
cd /[PATH/TO/MOODLECODE]/admin/cli/;
for i in `cat [/PATH/TO/MOODLECODE]/admin/cli/courseids.txt`
do
echo "Course ID in que:" $i;
php backup.php --courseid=$i --destination=/home/archive/
done
ls -l /home/archive/;
echo 'Done!';
First, run getcourseids .... from location of scripts.
source getcourseids
edit the courseids.txt file - remove first line
Run the niclibackups
source niclibackups
You could, of course, make getcourseids and niclibackups executable by root.
Depending upon how many courses, how 'large' they are, etc. even the command line scripts could take hours.
And, you might need to monitor in a terminal window disk free space.
watch 'df'
'spirit of sharing', Ken