# trackpath
**trackpath** is a Python package designed to monitor and track changes in a specified directory. It detects file creations, deletions, and modifications, providing real-time feedback either as a command-line tool or as a Python module in your scripts.
## Features
- **Real-Time Monitoring**: Instantly detects file creations, deletions, and modifications.
- **Flexible Usage**: Can be used both as a command-line tool and a Python module.
- **Detailed Change Information**: Returns detailed information about the type of change and the affected file.
## Installation
You can install the `trackpath` package using `pip`:
```bash
pip install trackpath
```
## Usage
### Command-Line Tool
To monitor a directory from the command line:
```bash
trackpath C:/telegram
```
This command will print details of any file changes (creation, deletion, modification) detected in the specified directory.
### Python Module
You can also use `trackpath` within your Python scripts:
```python
from trackpath import track_changes
# Track changes in the specified directory
change = track_changes("C:/telegram")
if change:
event_type = change["type"]
event_path = change["path"]
if event_type == 'modified':
print(f"File modified: {event_path}")
elif event_type == 'created':
print(f"File created: {event_path}")
elif event_type == 'deleted':
print(f"File deleted: {event_path}")
```
### Example
Here’s an example of using `trackpath` in a Python script:
```python
from trackpath import track_changes
directory_to_monitor = "C:/telegram"
# Continuously monitor the directory
while True:
change = track_changes(directory_to_monitor)
if change:
event_type = change["type"]
event_path = change["path"]
print(f"Detected {event_type} at {event_path}")
```
### Contributions
Contributions are welcome! Please feel free to submit a pull request or open an issue on the [GitHub repository](https://github.com/bytebreach/trackpath).
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Acknowledgments
Special thanks to the [watchdog](https://github.com/gorakhargosh/watchdog) library, which powers the file system monitoring capabilities of this package.
## Thank You
A heartfelt thank you to everyone who has supported and contributed to this project. Your encouragement and feedback are deeply appreciated and motivate me to continue improving and innovating.
Raw data
{
"_id": null,
"home_page": "https://github.com/bytebreach/trackpath",
"name": "trackpath",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "MrFidal",
"author_email": "mrfidal@proton.me",
"download_url": "https://files.pythonhosted.org/packages/f1/a7/2e59b35118a99719cdfbe5eaa92429e65180722af9540e730a5dca829eb7/trackpath-1.0.0.tar.gz",
"platform": null,
"description": "# trackpath\r\n\r\n**trackpath** is a Python package designed to monitor and track changes in a specified directory. It detects file creations, deletions, and modifications, providing real-time feedback either as a command-line tool or as a Python module in your scripts.\r\n\r\n## Features\r\n\r\n- **Real-Time Monitoring**: Instantly detects file creations, deletions, and modifications.\r\n- **Flexible Usage**: Can be used both as a command-line tool and a Python module.\r\n- **Detailed Change Information**: Returns detailed information about the type of change and the affected file.\r\n\r\n## Installation\r\n\r\nYou can install the `trackpath` package using `pip`:\r\n\r\n```bash\r\npip install trackpath\r\n```\r\n\r\n## Usage\r\n\r\n### Command-Line Tool\r\n\r\nTo monitor a directory from the command line:\r\n\r\n```bash\r\ntrackpath C:/telegram\r\n```\r\n\r\nThis command will print details of any file changes (creation, deletion, modification) detected in the specified directory.\r\n\r\n### Python Module\r\n\r\nYou can also use `trackpath` within your Python scripts:\r\n\r\n```python\r\nfrom trackpath import track_changes\r\n\r\n# Track changes in the specified directory\r\nchange = track_changes(\"C:/telegram\")\r\nif change:\r\n event_type = change[\"type\"]\r\n event_path = change[\"path\"]\r\n if event_type == 'modified':\r\n print(f\"File modified: {event_path}\")\r\n elif event_type == 'created':\r\n print(f\"File created: {event_path}\")\r\n elif event_type == 'deleted':\r\n print(f\"File deleted: {event_path}\")\r\n```\r\n\r\n### Example\r\n\r\nHere\u00e2\u20ac\u2122s an example of using `trackpath` in a Python script:\r\n\r\n```python\r\nfrom trackpath import track_changes\r\n\r\ndirectory_to_monitor = \"C:/telegram\"\r\n\r\n# Continuously monitor the directory\r\nwhile True:\r\n change = track_changes(directory_to_monitor)\r\n if change:\r\n event_type = change[\"type\"]\r\n event_path = change[\"path\"]\r\n print(f\"Detected {event_type} at {event_path}\")\r\n```\r\n\r\n### Contributions\r\n\r\nContributions are welcome! Please feel free to submit a pull request or open an issue on the [GitHub repository](https://github.com/bytebreach/trackpath).\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the LICENSE file for details.\r\n\r\n## Acknowledgments\r\n\r\nSpecial thanks to the [watchdog](https://github.com/gorakhargosh/watchdog) library, which powers the file system monitoring capabilities of this package.\r\n\r\n## Thank You\r\n\r\nA heartfelt thank you to everyone who has supported and contributed to this project. Your encouragement and feedback are deeply appreciated and motivate me to continue improving and innovating.\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A package to track file changes in a directory",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/bytebreach/trackpath"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f1a72e59b35118a99719cdfbe5eaa92429e65180722af9540e730a5dca829eb7",
"md5": "c00cc5b7d1eac39020c41d7c8b518f24",
"sha256": "f05d82a6f33349b5cad01050ec86c4455bad4d7d236f15dd46d33d348e40c928"
},
"downloads": -1,
"filename": "trackpath-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "c00cc5b7d1eac39020c41d7c8b518f24",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 3318,
"upload_time": "2024-09-02T03:54:32",
"upload_time_iso_8601": "2024-09-02T03:54:32.036755Z",
"url": "https://files.pythonhosted.org/packages/f1/a7/2e59b35118a99719cdfbe5eaa92429e65180722af9540e730a5dca829eb7/trackpath-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-02 03:54:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bytebreach",
"github_project": "trackpath",
"github_not_found": true,
"lcname": "trackpath"
}