This is a Rust project that uses the futures
, notify
, and regex
libraries. The main functionality of this project is to watch a specified source directory for file changes and copy the changed files to a destination directory if the file path matches a given regular expression.
To run the program, use the following command:
cargo run <source_path> <regex> <destination_path>
Where:
<source_path>
is the path to the source directory you want to watch.<regex>
is the regular expression that the file path needs to match.<destination_path>
is the path to the destination directory where the files will be copied to.
The main
function initializes the logger, retrieves the command line arguments, and starts the asynchronous file watcher.
The async_watcher
function creates a new file watcher and a channel for sending file change events.
The async_watch
function starts watching the specified source directory for file changes. If a file change event is received and the file path matches the given regular expression, the file is copied to the destination directory.
This project uses the following dependencies:
futures
: for asynchronous programming.notify
: for watching file changes.regex
: for matching file paths with a regular expression.
Please replace <source_path>
, <regex>
, and <destination_path>
with actual values when running the program.