def scanFiles( filesCollection, d, upload, host ): timing = timer.Timer() count = 0 topDown = True walker = FilterWalker( FileWalker( topDown ), (lambda all_files:True )) timing.start() for f in walker.walk( d ): try : count = count + 1 path = os.path.realpath( f ) debug.msg( "Checking: %s" % path ) checksum = filesCollection.addFile( path ) if upload : uploadFile( host, checksum, path ) except OSError : continue timing.stop() return ( count, timing.elapsed())