Reputation: 155
I need to restore about 70 course backups to a course area (id 20) in moodle. Is this possible via a terminal (ubuntu) via loop? THX
Upvotes: 1
Views: 640
Reputation: 155
We have create a bash-script for more backups
> read -p "Path to backup: " -r DIRECTORY
> read -p "Category-ID:" -r CATEGORYID
>
> BACKUPS=$(ls $DIRECTORY)
> array=( $BACKUPS ) for i in "${array[@]}" do
> cd httpdocs/
> echo ""
> echo ""
> echo "restored $i"
> echo ""
> sudo -u www-data php admin/cli/restore_backup.php --file=$DIRECTORY${i} --categoryid=$CATEGORYID
done
View the moodle documentation here
Upvotes: 1
Reputation: 10241
Do you mean a category? You can restore to a category via the command line
php admin/cli/restore_backup.php --file=/backupfolder/backupfile.mbz --categoryid=20
And just for reference, backup via command line
php admin/cli/backup.php --courseid=99
Or
php admin/cli/backup.php --courseshortname=mycourse
Restore via command line
Upvotes: 1