rusty-files

Rusty files is a simple collection of file functions that I use in my projects.

Instalation

bash cargo install rusty-files

Functons

delete_dir_contents - Recursively deletes all files and directories within a directory.
Arguments

```rust use rustyfiles::deletedir_contents; use std::path::Path;

fn main() { let dirpath = Path::new("path/to/dir"); deletedircontents(&dirpath); } ```

check_if_path_exists - Checks if a file or directory exists at the given path.
Arguments
Returns

A Result containing a bool indicating whether the file or directory exists (true) or not (false), or an std::io::Error if an I/O error occurred.

```rust use rustyfiles::checkifpathexists; use std::path::Path;

fn main() { let path = Path::new("path/to/file"); let pathexists = checkifpathexists(&path).unwrap(); println!("{}", path_exists); ```

Authors

Badges

MIT License

GitHub Sponsors