{"id":15009902,"url":"https://github.com/rob-white/folderspy","last_synced_at":"2025-04-09T17:52:21.108Z","repository":{"id":50201908,"uuid":"152832603","full_name":"rob-white/folderspy","owner":"rob-white","description":"Watch folders for file/directory events with a simple API","archived":false,"fork":false,"pushed_at":"2022-12-08T01:14:57.000Z","size":39,"stargazers_count":3,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T01:30:22.496Z","etag":null,"topics":["filesystem","folder-watch","linux","python","python2","python3","windows"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rob-white.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-13T03:48:29.000Z","updated_at":"2023-12-22T23:01:15.000Z","dependencies_parsed_at":"2023-01-24T06:31:08.413Z","dependency_job_id":null,"html_url":"https://github.com/rob-white/folderspy","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rob-white%2Ffolderspy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rob-white%2Ffolderspy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rob-white%2Ffolderspy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rob-white%2Ffolderspy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rob-white","download_url":"https://codeload.github.com/rob-white/folderspy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248083290,"owners_count":21045071,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["filesystem","folder-watch","linux","python","python2","python3","windows"],"created_at":"2024-09-24T19:29:04.615Z","updated_at":"2025-04-09T17:52:21.092Z","avatar_url":"https://github.com/rob-white.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# folderspy\r\n\r\n[![image](https://img.shields.io/pypi/v/folderspy.svg)](https://pypi.org/project/folderspy/)\r\n[![image](https://img.shields.io/pypi/pyversions/folderspy.svg)](https://pypi.org/project/folderspy/)\r\n\r\n\u003e Watch folders for file/directory events with a simple API.\r\n\r\n## Supports\r\n* Linux, Windows, Mac\r\n* Python 2.7 \u0026 3.4-3.7\r\n\r\n## Installation\r\n\r\n### pipenv\r\n```sh\r\npipenv install folderspy\r\n```\r\n\r\n### pip\r\n```sh\r\npip install folderspy\r\n```\r\n\r\n## Example\r\n\r\nCreate a ```WatchableFolder``` class for each of folders you want to watch then simply start watching them with ```FolderSpy```:\r\n```python\r\nimport pyinotify  # Linux Only\r\nfrom folderspy import WatchableFolder, FolderSpy\r\n\r\n\r\nclass SaveFolder(WatchableFolder):\r\n\r\n    def __init__(self):\r\n        super(SaveFolder, self).__init__()\r\n\r\n        self.path = '/path/to/this/folder'\r\n\r\n        # Note: Only used in Linux for pyinotify bitmasks\r\n        # Can be excluded for Windows/Mac\r\n        self.listen_to = pyinotify.IN_CREATE\r\n\r\n    def process_IN_CREATE(self, event):\r\n        print('An item was created in this folder!')\r\n    \r\n\r\nFolderSpy.watch(SaveFolder())\r\n```\r\n\r\n## Available Folder Events\r\n### Linux\r\n\r\n```python\r\n    def process_IN_ACCESS(self, event):\r\n        \"\"\"A file was accessed.\"\"\"\r\n\r\n    def process_IN_ATTRIB(self, event):\r\n        \"\"\"Metadata changed for a file.\"\"\"\r\n\r\n    def process_IN_CLOSE_NOWRITE(self, event):\r\n        \"\"\"An unwritable file was closed.\"\"\"\r\n\r\n    def process_IN_CLOSE_WRITE(self, event):\r\n        \"\"\"A writable file was closed.\"\"\"\r\n\r\n    def process_IN_CREATE(self, event):\r\n        \"\"\"A file/directory was created in watched directory.\"\"\"\r\n\r\n    def process_IN_DELETE(self, event):\r\n        \"\"\"A file/directory was deleted in watched directory.\"\"\"\r\n\r\n    def process_IN_DELETE_SELF(self, event):\r\n        \"\"\"The watched item itself was deleted.\"\"\"\r\n\r\n    def process_IN_ISDIR(self, event):\r\n        \"\"\"Any event occurred that was on a directory.\"\"\"\r\n\r\n    def process_IN_MODIFY(self, event):\r\n        \"\"\"A file was modified.\"\"\"\r\n\r\n    def process_IN_MOVE_SELF(self, event):\r\n        \"\"\"The watched item itself was moved somewhere.\"\"\"\r\n\r\n    def process_IN_MOVED_FROM(self, event):\r\n        \"\"\"A file/directory was moved away from the current watched directory.\"\"\"\r\n\r\n    def process_IN_MOVED_TO(self, event):\r\n        \"\"\"A file/directory was moved into the current watched directory.\"\"\"\r\n\r\n    def process_IN_OPEN(self, event):\r\n        \"\"\"A file was opened.\"\"\"\r\n\r\n    def process_IN_UNMOUNT(self, event):\r\n        \"\"\"The file system the watched directory is associated with was unmounted.\"\"\"\r\n```\r\n\r\n### Windows\r\n```python\r\n    def process_IN_CREATE(self, event):\r\n        \"\"\"A file/directory was created in watched directory.\"\"\"\r\n\r\n    def process_IN_DELETE(self, event):\r\n        \"\"\"A file/directory was deleted in watched directory.\"\"\"\r\n\r\n    def process_IN_MODIFY(self, event):\r\n        \"\"\"A file was modified.\"\"\"\r\n\r\n    def process_IN_RENAMED_FROM(self, event):\r\n        \"\"\"The name the file/directory was renamed from.\"\"\"\r\n\r\n    def process_IN_RENAMED_TO(self, event):\r\n        \"\"\"The name the file/directory was renamed to.\"\"\"\r\n\r\n    def process_IN_ISDIR(self, event):\r\n        \"\"\"An event occurred that was on a directory.\"\"\"\r\n```\r\n\r\n### Mac\r\n```python\r\n    def process_IN_ATTRIB(self, event):\r\n        \"\"\"Metadata changed for a file.\"\"\"\r\n\r\n    def process_IN_CREATE(self, event):\r\n        \"\"\"A file/directory was created in watched directory.\"\"\"\r\n\r\n    def process_IN_DELETE(self, event):\r\n        \"\"\"A file/directory was deleted in watched directory.\"\"\"\r\n\r\n    def process_IN_MODIFY(self, event):\r\n        \"\"\"A file was modified.\"\"\"\r\n\r\n    def process_IN_MOVED_FROM(self, event):\r\n        \"\"\"A file/directory was moved away from the current watched directory.\"\"\"\r\n\r\n    def process_IN_MOVED_TO(self, event):\r\n        \"\"\"A file/directory was moved into the current watched directory.\"\"\"\r\n```\r\n\r\n## Dependencies\r\n* Linux: ```pyinotify```\r\n* Windows: ```pypiwin32```\r\n* Mac: ```macfsevents```\r\n\r\n## To-Do\r\n* Start/Exit Events\r\n* Tests\r\n* Clean-up\r\n\r\n## Contribute\r\nPull requests are welcome to add in functionality or fix bugs!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frob-white%2Ffolderspy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frob-white%2Ffolderspy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frob-white%2Ffolderspy/lists"}