#events #file #workflow #command #directories #modification #creation

bin+lib watchcrab

WatchCrab is a Rust-based command-line tool for monitoring directories, triggering custom actions on file system events like creation, modification, or deletion—ideal for automating tasks or logging changes, with seamless integration for advanced workflows

6 releases (breaking)

new 0.6.0 Oct 27, 2024
0.5.0 Oct 15, 2024
0.4.0 Oct 13, 2024
0.3.0 Oct 13, 2024
0.2.1 Oct 10, 2024

#448 in Filesystem

Download history 121/week @ 2024-10-05 394/week @ 2024-10-12 25/week @ 2024-10-19 131/week @ 2024-10-26

671 downloads per month

MIT license

24KB
405 lines

WatchCrab

» Crate » Downloads

watchcrab is a Rust-based command-line tool that monitors directories for filesystem events such as file creation, modification, and deletion. It allows you to execute shell commands when these events occur, making it ideal for automating file processing tasks or generating logs.

Project Status

WatchCrab is currently with the main features implemented but is not stable yet. The project is under active development, and new features and improvements are being added regularly. If you encounter any issues or have suggestions for improvements, please open an issue.

Features

  • Directory Monitoring: Observe directories for a wide range of filesystem events, including file creation, modification, deletion, and more.
  • Automated Command Execution: Optionally Trigger customizable shell commands automatically in response to detected events.
  • Asynchronous Event Handling: Optionally handle events asynchronously to improve performance and responsiveness.
  • Optimized for Automation Workflows: Designed to integrate smoothly into automation pipelines with minimal configuration.
  • JSON Output: Provides structured JSON output for straightforward parsing and seamless integration with other tools.
  • Graceful Shutdown (Unix-like systems): Ensures safe program termination by waiting for all in-progress commands to finish executing before shutting down. This prevents abrupt termination, reducing the risk of data loss or unexpected errors.
  • Cross-Platform Compatibility: Runs on both Unix-like systems (Linux, macOS) and Windows.
  • Logging of Command Output: Optionally Saves the stdout and stderr of executed commands to a file for easy debugging and record-keeping.

Installation

Binary Installation

  1. No prerequisites are required to run the binary.
  2. Go to the releases page and download the latest version for your operating system.
  3. Extract the .zip file to a directory of your choice.
  4. Add the binary to your PATH or provide the full path when running the command (or create an alias).

Cargo Installation

Prerequisites:

  • Rust (1.81.0 or later)
  • Cargo

With Rust and Cargo installed, you can install watchcrab using the following command:

cargo install watchcrab

Usage

To view all available options, use the --help flag:

watchcrab --help

For example, for starting to watch a directory for all filesystem events in the current directory recursively:

watchcrab --recursive

To view more usage examples, see the usage examples documentation.

Additional Documentation

You can find the full documentation for watchcrab on crates.io.

Contributing

Contributions are welcome! Please feel free to open issues or submit pull requests on the GitHub repository.

Dependencies

~2–9MB
~87K SLoC