Re: os.walk restart

2010-03-31 Thread Piet van Oostrum
You have no guarantee that on the next run the directories will be visited in the same order as in the first run (this could depend on the filesystem). So then remembering a last directory won't do it. You could write each completed directory name to a file, and then on the second run check whether

Re: os.walk restart

2010-03-18 Thread Tim Chase
Steve Howell wrote: If that's the case, then you might be able to get away with just leaving some kind of breadcrumbs whenever you've successfully processed a directory or a file, Unless you're indexing a read-only device (whether hardware read-only like a CD, or permission-wise read-only like

Re: os.walk restart

2010-03-17 Thread Steven D'Aprano
On Wed, 17 Mar 2010 20:08:48 -0700, alex23 wrote: > Steven D'Aprano wrote: >> # 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 > > Wouldn't this only walk

Re: os.walk restart

2010-03-17 Thread Steve Howell
On Mar 17, 3:04 pm, 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

Re: os.walk restart

2010-03-17 Thread MRAB
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 dir

Re: os.walk restart

2010-03-17 Thread alex23
Steven D'Aprano wrote: > # 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 Wouldn't this only walk the directory the exception occured in and not the rem

Re: os.walk restart

2010-03-17 Thread Gabriel Genellina
En Wed, 17 Mar 2010 19:04:14 -0300, Keir Vaughan-taylor escribió: 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

Re: os.walk restart

2010-03-17 Thread Steven D'Aprano
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