import os
class howema():
initflag = False
def __init__(self,dir):
self.dir_ = dir
if os.path.isdir(dir):
initflag = True
def process(self):
ret = False
if initflag:
(dir,dirnames, filenames) = os.walk(self.dir_)
for filename in filenames:
content = filename.read()
# add content in database by sql
os.remove(os.path.join(dir,filename))
for dir in dirnames:
subprocess(dir)
ret = True
return ret
def subprocess(self,dir):
(dir,dirnames, filenames) = os.walk(dir)
for filename in filenames:
content = filename.read()
# add content in database by sql
os.remove(os.path.join(dir,filename))
for subdir in dirnames:
subprocess(subdir)