Skip to content

Instantly share code, notes, and snippets.

@distributedlock
Last active August 29, 2015 14:16
Show Gist options
  • Save distributedlock/581aeff1d1b37a8433c7 to your computer and use it in GitHub Desktop.
Save distributedlock/581aeff1d1b37a8433c7 to your computer and use it in GitHub Desktop.
WLU: Marking script for unzipping and deleting temp files.
#!/usr/bin/env python3
__author__ = "RanadeepPolavarapu"
__email__ = "pola3120@mylaurier.ca"
__version__ = "1.0.0"
import os
import shlex
print("[INFO]: Iterating file list...")
for file in os.listdir("."):
if file.endswith(".zip"):
student_login = file.split('-')[-1].rstrip('.zip')
os.system(
"unzip {ZIP_FILE} -d {STUDENT_DIR} 1> /dev/null".format(
ZIP_FILE=shlex.quote(file),
STUDENT_DIR=student_login))
print("[INFO]: Unzipped all files!")
print("[INFO]: Deleting all temp C lang files...")
os.system("""find . -type f -name "\#*" -delete 1> /dev/null""")
os.system("""find . -type f -name "*~" -delete 1> /dev/null""")
os.system("""find . -type f -name "*.o" -delete 1> /dev/null""")
print("[INFO]: Cleaned out all backup and temp files!")
os.system("""rm -rf *.zip 1> /dev/null""")
print("[INFO]: Ready for marking!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment