synching with os.walk()

Andre Meyer meyer at acm.org
Fri Nov 24 18:03:56 CET 2006


That sounds like a good approach.

On 24 Nov 2006 08:27:09 -0800, Paddy <paddy3118 at netscape.net> wrote:
>
>
> 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é
>
> Walk each tree individually gathering file names relative to the head
> of the tree and modification data.
>
> compare the two sets of data to generate:
> 1. A list of what needs to be copied from the original to the copy.
> 2. A list of what needs to be copied from the copy to the original
>
> Do the copying.
>
> |You might want to show the user what needs to be done and give them
> the option of aborting after generating the copy lists.
>
> - Paddy.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20061124/ae0cdf3a/attachment.html>


More information about the Python-list mailing list