-
Notifications
You must be signed in to change notification settings - Fork 0
/
save.py
34 lines (30 loc) · 1.16 KB
/
save.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
import os,time,math,sys
from shutil import copyfile
def save(folder,CWD='E:\\'):
if folder == "" or folder is None:
folder=str(math.floor(time.time()))
CONTROLLER=os.path.join(CWD,'controller')
STATIC=os.path.join(CONTROLLER,'static')
DATA=os.path.join(CWD,'data')
outputFolder=os.path.join(DATA,folder)
plotFolder=os.path.join(outputFolder,'images')
metaFolder=os.path.join(outputFolder,'meta')
binaryFolder=os.path.join(outputFolder,'binary')
print("Creating folder",outputFolder)
os.mkdir(outputFolder)
os.mkdir(plotFolder)
os.mkdir(metaFolder)
os.mkdir(binaryFolder)
images=[f for f in os.listdir(STATIC) if '.png' in f]
txts=[f for f in os.listdir(CWD) if '.txt' in f]
waves=[f for f in os.listdir(CONTROLLER) if '.dat' in f and 'wave' in f]
for wave in waves:
copyfile(os.path.join(CONTROLLER,wave), os.path.join(binaryFolder,wave))
for image in images:
copyfile(os.path.join(STATIC,image),os.path.join(plotFolder,image))
for txt in txts:
copyfile(os.path.join(CWD,txt),os.path.join(metaFolder,txt))
print("======== SAVE COMPLETED =========")
if __name__=='__main__':
folder=input("Enter a folder name (empty for unix time): ")
save(folder)