Created
April 4, 2011 23:20
-
-
Save fredrick/902688 to your computer and use it in GitHub Desktop.
Example strategy to re-walk files that were not accounted for.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import multiprocessing | |
class Event(object): | |
"""Mock event type""" | |
def __init__(self, **kwargs): | |
for key in kwargs: | |
setattr(self, key, kwargs[key]) | |
"""Scan directory for new files to be indexed | |
Walks through event.pathname on directory created/modified | |
""" | |
def directory_rewalk(self, pathname): | |
for root, edges, nodes in os.walk(pathname): | |
for file_node in nodes: | |
event = Event( | |
pathname=os.path.join(root, file_node), | |
name=file_node, | |
dir=False) | |
process = multiprocessing.Process(target=self.event_create, args=(event,)) | |
process.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment