I have a directory with a lot of sub directories.
I am running through these directories and finding some files and running some commands on these files. How can I place a pointer to where i finish at? Sometimes the process gets disrupted and the next time I run the program, I want to start at where I left off.
def locate(pattern, root=os.curdir):
'''Locate all files matching supplied filename pattern in and below
supplied root directory.'''
for path, dirs, files in os.walk(os.path.abspath(root)):
for filename in fnmatch.filter(files, pattern):
yield os.path.join(path, filename)
for filename in locate("*.dll"):
#do something