-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmvdb.py
34 lines (27 loc) · 985 Bytes
/
mvdb.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
from subprocess import call
import os.path
from time import strftime
#Script to move the blue hydra database and logs each time the rPi boots.
PATH = '/home/pcgeller/workspace/bigtooth/'
files = {'db':'blue_hydra.db',
'log':'blue_hydra/blue_hydra.log',
'rssi':'blue_hydra/blue_hydra_rssi.log'}
storage = {'db':'dbs',
'log':'logs',
'rssi':'rssi'}
for k in files:
filepath = os.path.join(PATH, files[k])
storagepath = os.path.join(PATH, storage[k],\
''.join(['blue_hydra','.',k,'.',strftime("%Y-%m-%d_H%HM%M")]))
if os.path.isfile(filepath) == True:
print(files[k] + ':File exists, moving.')
call(['mv', filepath, storagepath])
print("File moved to" + storagepath)
#Should add some exception handling.
else:
print(filepath,':Does not exist.')
next
def makefiles(): # for testing
for k in files:
filepath = os.path.join(PATH, files[k])
call(['touch',filepath])