import sys, os, datetime
logs = []
plog = open("process.log",'wa')
_pathto = "/media/mountname/"
command = "mv *-log* "
def getTime():
todaystring = datetime.datetime.today().strftime("%Y-%m-%d %H:%M:%S")
return "["+todaystring+"] -- "
delta = 0
i = hci0
while True:
delta+=1
tempDev = os.popen("hcitool -i "+i+" scan --flush")
repl = [e.strip() for e in tempDev.readlines()]
fi = open(i+"-log-"+str(delta)+".txt","w")
for line in repl:
if not("Scanning" in line):
fi.write(getTime() + line.replace(" "," ")+"\n")
fi.close()
tempCp = os.popen(command + _pathto)