Crates.io | filetools |
lib.rs | filetools |
version | 0.3.0 |
source | src |
created_at | 2020-04-08 13:03:54.529999 |
updated_at | 2024-02-10 20:36:44.275007 |
description | Helper functions for path operations |
homepage | |
repository | https://github.com/Tyrannican/filetools-rs |
max_upload_size | |
id | 227615 |
size | 83,968 |
Simple crate for perfoming some small Path
operations in Rust.
Offers the user the ability to:
PathBuf
namesMore will be added in the future but this should suffice for small path operations.
Add to your Cargo.toml
[dependencies]
filetools = "0.3.0"
Then import into your project:
use filetools::{FtFilter, list_nested_files_with_filter};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Get all Lua files in the Neovim directory
let root_path = "/home/user/.config/nvim";
let filter = FtFilter::Raw("lua".to_string());
let lua_files = list_nested_files_with_filter(&root_path, filter).await?;
// Delete them all, we hate Lua
for lua_file in lua_files.into_iter() {
tokio::fs::remove_file(lua_file).await?;
}
Ok(())
}