-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopy_bot.py
33 lines (23 loc) · 941 Bytes
/
copy_bot.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
import sys
import os
def main():
args = sys.argv
if len(args) != 3:
print("Usage: ./{} <source directory> <destination directory>")
print("Usage: ./{} initialBot nextBot")
return
source = args[1]
destination = args[2]
print("Copying {} to {}".format(source, destination))
# go to src directory
# subprocess.run(["cd", "src"], shell=True)
# copy folder
os.system("cd src && cp -a {}/. {}/".format(source, destination))
# subprocess.run(["cp", "-a", source + "/.", destination + "/"], shell=True)
# go to destination directory
# subprocess.run(["cd", destination], shell=True)
# replace all instances of source
os.system("cd src/{} && sed -i -e 's/{}/{}/g' $(find . -type f)".format(destination, source, destination))
# subprocess.run(["sed", "-i", "'s/" + source + "/" + destination + "/g'", "*"], shell=True)
if __name__ == "__main__":
main()