Skip to content

Instantly share code, notes, and snippets.

@fredrick
Created April 4, 2011 23:20
Show Gist options
  • Save fredrick/902688 to your computer and use it in GitHub Desktop.
Save fredrick/902688 to your computer and use it in GitHub Desktop.
Example strategy to re-walk files that were not accounted for.
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