This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author robpy1
Recipients georg.brandl, robpy1
Date 2007-09-07.07:34:14
SpamBayes Score 0.041171763
Marked as misclassified No
Message-id <1189150455.37.0.599498418699.issue1764044@psf.upfronthosting.co.za>
In-reply-to
Content
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....
History
Date User Action Args
2007-09-07 07:34:15robpy1setspambayes_score: 0.0411718 -> 0.041171763
recipients: + robpy1, georg.brandl
2007-09-07 07:34:15robpy1setspambayes_score: 0.0411718 -> 0.0411718
messageid: <1189150455.37.0.599498418699.issue1764044@psf.upfronthosting.co.za>
2007-09-07 07:34:15robpy1linkissue1764044 messages
2007-09-07 07:34:14robpy1create