Write a python script that has the following functionality.
1. Unpack the .tar.gz supplied from the command line into a directory named COMP2002/
[user@pc]$ python3 usp.py USP_Final_Assessment_Sample.tar.gz
2. Isolate the Student ID of each file inside the archive. These files will be some form of executable, such as a shell script or Python script.
3. Change the name of every file inside to be:
<StudentID>_FinalAssessment.<Extension>
4. For each student’s file, change the permissions of the file so that it is executable.
5. Attempt to execute each student’s file, redirecting stderr to a file called ’errors.out’. This file must contain all errors from all the files, not just the latest error.
6. The script must finally output a report of which student files did not exit gracefully along with their exit status.
7. Finally, make two compressed files: one for student files that exited successfully, one for student files that did not.
Note: Format of File Names within the archive:
<StudentID>_attempt_<DateTime>_<FileName>.<Extension>
The final page has an example of the directory structure of this.
Ensure if at any point something is invalid you notify the user.
You may test your script on the sample USP_Final_Assessment_Sample.tar.gz located in the same spot you downloaded this assessment from. [45 marks]