synching with os.walk()

Antoine De Groote antoine at vo.lu
Fri Nov 24 16:44:10 EST 2006


Andre Meyer wrote:
> Hi all
> 
> os.walk() is a nice generator for performing actions on all files in a 
> directory and subdirectories. However, how can one use os.walk() for 
> walking through two hierarchies at once? I want to synchronise two 
> directories (just backup for now), but cannot see how I can traverse a 
> second one. I do this now with os.listdir() recursively, which works 
> fine, but I am afraid that recursion can become inefficient for large 
> hierarchies.
> 
> thanks for your help
> André
> 

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/191017
might be what you are looking for, or at least a starting point...

Regards,
antoine



More information about the Python-list mailing list