-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopy_files.py
47 lines (38 loc) · 1.48 KB
/
copy_files.py
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
import csv
import shutil
import os
import sys
import distutils
from distutils import dir_util
if len(sys.argv) != 2:
print("Incorrect number of parameters provided")
sys.exit()
patchnumber = str(sys.argv[1])
src = "D:/Steam/SteamApps/common/rocketleague/Binaries/Win32/bakkesmod/testmod"
dest = "D:/BakkesMod-PatchTest/RocketLeaguePatchTesterResults/current_patch"
dest_numbered = os.path.join("D:/BakkesMod-PatchTest/RocketLeaguePatchTesterResults", patchnumber)
def recursive_overwrite(src, dest, ignore=None):
if os.path.isdir(src):
if not os.path.isdir(dest):
os.makedirs(dest)
files = os.listdir(src)
if ignore is not None:
ignored = ignore(src, files)
else:
ignored = set()
for f in files:
if f not in ignored:
recursive_overwrite(os.path.join(src, f),
os.path.join(dest, f),
ignore)
recursive_overwrite(src, dest)
for path, dirs, files in os.walk(src):
for filename in files:
if 'current.cfg' in filename:
continue
fullpath = os.path.join(path, filename)
semicolonin = csv.reader(open(fullpath, 'r', newline=''), delimiter=';')
dest_fullpath = dest + "/" + path[len(src)+1:] + "/" + filename
commaout = csv.writer(open(dest_fullpath, 'w', newline=''), delimiter=',')
commaout.writerows(semicolonin)
distutils.dir_util.copy_tree(dest, dest_numbered)