skip to Main Content

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

2

Answers


  1. Chosen as BEST ANSWER

    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

    https://docs.moodle.org/402/en/Course_backup


  2. 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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search