Skip to content

Instantly share code, notes, and snippets.

@gruvw
Created January 7, 2024 11:29
Show Gist options
  • Save gruvw/8b5b0c3e3b5be9ec15e2dcf8c4044e09 to your computer and use it in GitHub Desktop.
Save gruvw/8b5b0c3e3b5be9ec15e2dcf8c4044e09 to your computer and use it in GitHub Desktop.
Fix MP2 submission
import os
import sys
import glob
def main():
if len(sys.argv) < 2:
print("Usage: python fix_submission.py <SCIPER1-SCIPER2>")
sys.exit(1)
PROJECT = sys.argv[1]
SRC = f"{PROJECT}/src/"
os.makedirs(SRC, exist_ok=True)
for file in glob.glob(f"{PROJECT}/main*"):
path = file.strip(f"{PROJECT}/")
path = path.replace("\\", "/")
slash = path.rfind("/")
directory = path[:slash + 1]
name = path[slash + 1:]
destination = SRC + directory
os.makedirs(destination, exist_ok=True)
os.rename(file, destination + name)
print(f"Moved {name}")
print("Done :)")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment