#python how to find directories by name and the name start by some fixed character and end by random characters.
import os
import re
bdire = input("base dire : ")
myext = input("type folder name : ")
txtoutput = input("file output : ")
reg_compile = re.compile(myext +".*")
def sessionSsave(nSess):
sessFile = open(txtoutput,"a+")
#sessnum = sessFile.readlines()
#numer = len(sessnum)
sessFile.write(str(nSess))
sessFile.close()
for root, dirs, filenames in os.walk(bdire):
for dir in dirs:
if reg_compile.search(dir):
print(os.path.join(root,dir))
tosave = os.path.join(root, dir)+"\r\n"
sessionSsave(tosave)