-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mark Heramis <[email protected]>
- Loading branch information
Mark Heramis
committed
Mar 30, 2024
1 parent
765e295
commit d5d225e
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# File Watcher Experiment | ||
This is a simple Rust program that watches a specified directory for file system events such as file creation, modification, and deletion. | ||
|
||
## Overview | ||
The program uses the notify crate to watch a directory and handle file system events. It sets up a watcher on a specified directory and then enters a loop where it sleeps for one second at a time, checking each time if a Ctrl+C interrupt signal has been received. If such a signal is received, the program exits. | ||
|
||
When a file system event occurs in the watched directory, the program handles the event by printing the paths of the affected files and the kind of event (create, modify, or remove). | ||
|
||
## Usage | ||
To run the program, use the following command: | ||
|
||
```bash | ||
cargo run | ||
``` | ||
By default, the program watches the C:\\WatchDir directory. If this directory does not exist, the program will print an error message and exit. You can change the directory by modifying the path variable in the main function. | ||
|
||
## Dependencies | ||
This program depends on the following crates: | ||
- ctrlc version 3.4.4: for handling Ctrl+C interrupt signals. | ||
- notify version 6.1.1: for watching directories and handling file system events. | ||
|
||
## Note | ||
This program is an experiment and is not intended for production use. It may not handle all edge cases and error conditions. | ||
|
||
## License | ||
This project is licensed under the MIT License - see the LICENSE.md file for details. |