robs pythonid
                                 added the comment:

Thanks for your reaction, I do not really now the answer to your 
question but I added the code to copy files in a directory (to keep it 
simple I removed the recursiveness):

import os
import shutil

sourcedir="d:\\testsourcedir"
targetdir="d:\\testtargetdir"

filelist=os.listdir(sourcedir)  
for afile in filelist:
    source=sourcedir + "\\" + afile
    if os.path.isfile(source):
        time1=os.path.getmtime(source)
        print source,time1,
        docopy=0
        target=targetdir+"\\"+afile
        if os.path.isfile(target):
            time2=os.path.getmtime(target)
            if time1>time2:
                docopy=1
        else:
            docopy=1
        if docopy==1:
            print " ....copying"
            shutil.copy2(source,target)
        else:
            print " not copied"

If I run this program twice without changing any file in the source 
directory it should not copy any files anymore (but is does 20% of the 
files it there are 100000 files). Now that I have been thinking about 
this a little the problems I see, happen on a Windows Vista Business 
machine, on my XP machine i don't seem to be able to reproduce the 
issues, maybe it is somethin in Vista.....

quite frustrating....

_____________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1764044>
_____________________________________
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to