to reproduce - create a new moodle install. create a course and add a scorm object.
delete the database, and reinstall moodle, create a course and add a scorm object.
"rename" fails, as it tries to rename to a folder that already exists.
in function scorm_add_instance() for scorm/lib.php
before this line is called:
a check should be made to see if ($scorm->dir.'/'.$id) exists and if so delete it's contents before continuing.