On Wed, 17 Mar 2010 15:04:14 -0700, Keir Vaughan-taylor wrote: > I am traversing a large set of directories using > > for root, dirs, files in os.walk(basedir): > run program > > Being a huge directory set the traversal is taking days to do a > traversal. > Sometimes it is the case there is a crash because of a programming > error. > As each directory is processed the name of the directory is written to a > file
What, a proper, honest-to-goodness core dump? Or do you mean an exception? > I want to be able to restart the walk from the directory where it > crashed. > > Is this possible? Quick and dirty with no error-checking: # Untested last_visited = open("last_visited.txt", 'r').read() for root, dirs, files in os.walk(last_visited or basedir): open("last_visited.txt", 'w').write(root) run program -- Steven -- http://mail.python.org/mailman/listinfo/python-list