Skip to main content

A package to track file changes in a directory

Project description

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:

pip install trackpath

Usage

Command-Line Tool

To monitor a directory from the command line:

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:

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:

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.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Special thanks to the 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trackpath-1.0.0.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file trackpath-1.0.0.tar.gz.

File metadata

  • Download URL: trackpath-1.0.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.2

File hashes

Hashes for trackpath-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f05d82a6f33349b5cad01050ec86c4455bad4d7d236f15dd46d33d348e40c928
MD5 c00cc5b7d1eac39020c41d7c8b518f24
BLAKE2b-256 f1a72e59b35118a99719cdfbe5eaa92429e65180722af9540e730a5dca829eb7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page