import subprocess
import os
from datetime import datetime,timedelta,timezone
import uuid
import pickle
import random
files =os.listdir("./babel")
element_z = [f for f in files if os.path.isfile(os.path.join("./babel", f))]
print(element_z)
element = []
aftername = []
for i in element_z:
a=i.replace(".com","")
element.append(a)
JST = timezone(timedelta(hours=+9))
print(datetime.now(JST))
cheat_dict = {}
cnt = 0
flag = False
mk = ["mkdir","uuid"]
subprocess.run(mk)
cd = ["cd","uuid"]
subprocess.run(cd)
mkd =["mkdir","index"]
subprocess.run(mkd)
for i in element:
uid = str(uuid.uuid4())[-10:]
time = datetime.now(JST)
#分子名+UUID+時間ver
#////////////----------////////////---------------
b = element[cnt] +" "+uid+time.strftime('%Y%m%d_%H%M%S')
cmd = ["g16",i,b]
subprocess.run(cmd)
#////////////----------////////////---------------
#////////////----------////////////---------------
#Time_UUIDのみのために。
b = uid + time.strptime('%Y%m%d_%H%M%S')
cmd = ["g16",i,b]
subprocess.run(cmd)
#チートシートの作成
cheat_dict[i] = b
flag = True
#////////////----------////////////---------------
cnt = cnt + 1
if flag == True:
with open("/uuid/index/index.txt","wb")as f:
pickle.dump(cheat_dict,f)
f.close()