Scanning folders

Pieter Claerhout PClaerhout at CREO.BE
Wed Mar 1 07:19:32 EST 2000


No solutioins that works on PC/Mac/Unix??

Pieter

-----Original Message-----
From: Darrell [mailto:darrell at dorb.com]
Sent: Wednesday, March 01, 2000 4:06 AM
To: Pieter Claerhout; python-list at python.org
Subject: Re: Scanning folders


If your talking about NT then give this a try.
http://www.dorb.com/darrell/win32WorkSvr/makeThumbsDG.py

def main():
    """
    Use events to avoid polling.
    A sleep is used to give most files a chance to finish
    being writen. Sort of a hack and might not be needed.
    The notification event LAST_WRITE seems to trigger
    at the start and end of writing. So a single file
    will trigger this twice.
    """
    hnd=win32file.FindFirstChangeNotification\
        (os.path.abspath('.')+os.sep+'incoming'\
        ,0, winnt.FILE_NOTIFY_CHANGE_LAST_WRITE )

    while 1:
        int = win32event.WaitForSingleObject( hnd, -1)
            # Try to give the file time to finish writing
        time.sleep(2)
        print 'run'
        try:
            passed, failed, skipped = makeThumbNails()
        except:
            if '-d' in sys.argv:
                traceback.print_exc()
            raise ThumbNailException
        win32file.FindNextChangeNotification(hnd)



----- Original Message ----- 
From: "Pieter Claerhout" <PClaerhout at CREO.BE>
To: <python-list at python.org>
Sent: Monday, February 28, 2000 3:35 AM
Subject: Scanning folders


> Hello,
> 
> what is the best and fastest way to scan a whole list of folders
> to see if something is added or not. Please note that this should
> also work for more than 1000 folders (and it shouldn't slow down
> the system too much).
> 
> Kind regards,
> 
> 
> Pieter
> 
> -- 
> http://www.python.org/mailman/listinfo/python-list
> 




More information about the Python-list mailing list