forked from VATSIM-UK/UK-Sector-File
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathairportreform.py
More file actions
19 lines (14 loc) · 747 Bytes
/
airportreform.py
File metadata and controls
19 lines (14 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import os
for filename in os.listdir("Airports/Other"):
file = open(os.path.dirname(os.path.realpath(__file__)) + "/Airports/Other/" + filename, "r")
lines = file.readlines()
file.close()
foldername = os.path.splitext(filename)[0]
if os.path.exists(os.path.dirname(os.path.realpath(__file__)) + "/Airports/" + foldername):
continue
os.makedirs(os.path.dirname(os.path.realpath(__file__)) + "/Airports/" + foldername)
newFile = open(os.path.dirname(os.path.realpath(__file__)) + "/Airports/" + foldername + "/Basic.txt", "w")
for line in lines:
newFile.write(line.strip() + "\n")
newFile.close()
os.remove(os.path.dirname(os.path.realpath(__file__)) + "/Airports/Other/" + filename)