Repository navigation
Expand file tree
/
Copy pathPython_Archive_Runner.py
More file actions
54 lines (48 loc) · 2.28 KB
/
Copy pathPython_Archive_Runner.py
File metadata and controls
54 lines (48 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import zipfile
import os
os.system("cls")
print("Python Archive Runner | Version 0.4")
print("mac and linux versions coming eventualy")
print("\ncommands: \nexit - exits the program \ndir - prints current directory \nrun - runs PAR of your choice \nabout - prints about screen \nclear - resets the screen \nconvert - converts .zip files to .par files\n")
list = []
while True:
cmd = input()
if cmd == "exit":
os.system("cls")
exit()
elif cmd == "dir":
dir = os.listdir()
print("\n", dir, "\n")
elif cmd == "about":
print("\nPython_Archive_Runner \nversion 0.4\nmade for windows\nmade by wizard studios\nCopyleft MMXXIV - MMXXV (remind me to update)\n")
elif cmd == "clear":
os.system("cls")
print("Python Archive Runner | Version 0.4")
print("mac and linux versions coming eventualy")
print("\ncommands: \nexit - exits the program \ndir - prints current directory \nrun - runs PAR of your choice \nabout - prints about screen \nclear - resets the screen \nconvert - converts .zip files to .par files \n")
elif cmd == "convert":
print("\ntype the name of the file you want to convert to .par (extension required)\n")
sfile = input()
if os.path.isfile(sfile):
print("\ntype the what you want the name of the output file to be (no extension required)\n")
ofile = input()
os.rename(sfile, ofile + ".par")
else:
print("Mission Failed, we'll get em' next time: you miswrote the filename")
elif cmd == "run":
print("\ntype the name of the .par file that you want to run or type exit to exit (include the extension)\n")
file = input()
if os.path.isfile(file):
with zipfile.ZipFile(file, "r") as read:
read.extractall()
for i in read.namelist():
list.append(i)
read.close()
with zipfile.ZipFile(file, "w") as read:
os.system("python main.py")
for i in list:
read.write(i)
os.remove(i)
read.close()
else:
print("Mission Failed, we'll get em' next time: you miswrote the filename")