files,folders,paths

Tim Roberts timr at probo.com
Sun Feb 13 23:23:40 CET 2011


ecu_jon <hayesjdno3 at yahoo.com> wrote:

>i have a samba server at home (acting as my test environment) with one
>of the 'shares' mounted as v: on my windows box. inside of that are 4
>folders week[1-4]. i have created c:\users\name\backup , and put a few
>files/folders in there to test with. please ignore the wxpython parts
>of the script, the last 1/3, that part is functional. initial test was
>looking good. (in the code, ver011 source1, destination1) coping files/
>folders and not clobbering files. going to version 12a, it seems like
>it is trying to copy the files under the folder, before making the
>folder. 

Where do you think your code is creating the folder?  I don't see that
happening anywhere.

I also don't understand why you are doing another os.listdir().  Everything
you need is already being supplied to you by the os.walk, and it is taking
the extra step of separating the directories and the files automatically.

Why can't you just iterate through "dirs" creating your subdirectories, and
then iterate through "files" doing the copies?  Then, when os.walk calls
you with the files in the subdirectories, you'll know those directories
already exist.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list