UPDATE : There are two version of this script. Output of both is same but they work on different version of moodle. This script (with configuration file available inside the repo) should work with new moodle while this one (with this configuration) should work with old moodle.
Downloading each student’s assignment from moodle could be a real pain. I’ve updated my old scripts which download assignments from Moodle and stores each student’s assignment in a separate directory named after student. In your home folder .moodlerc file must exists with all details.
These scripts depends on various python-libraries; most of them are in standard library. However, you need to install mechanize.
A few thing about configuration file
Each line (not suffixed with char #) is configuration variable in key = value format. The fields username and password are usual moodle username and password. If you leave password field empty then you have to submit it during execution.
Next is course which should be a regular pattern i.e. if course is EE 705 : V L S I Design Lab then course = EE 705 would be sufficient. Notice that you do not have to enclose any text string using commas etc. If you have two courses with same regular pattern then only first of them will be selected. Then we have activities which should be set to Assignments (open your moodle course page and see what is exact spelling in your course page for assignment, casing of characters matters here.) New moodle gives each assignment an unique name.
[This is only for old script] Once you will click on assignments, there would be more than one assignments, all of them can be put using activity = line. For instance, in sample file Lab session 1 and Lab session 2 are two assignments. It will take care of the rest. It will go to each student, create a directory in his/her name and download submission into that directory. If extract=true then it will also extract archive files. Make sure only one archive file is submitted per assignment.
PS : Some moodle server does not allow robots and automatic logging. To overcome this, this scripts sends wrong information to moodle-server. It tells it that it is “Mozilla Firefox on Ubuntu”.