Crates.io | force-delete-win |
lib.rs | force-delete-win |
version | 0.1.0 |
source | src |
created_at | 2022-10-25 19:47:38.325028 |
updated_at | 2022-10-25 19:47:38.325028 |
description | Force-delete a file or folder held by other Windows processes |
homepage | https://github.com/andfoy/force-delete-win |
repository | https://github.com/andfoy/force-delete-win |
max_upload_size | |
id | 697154 |
size | 21,984 |
Force delete a file or folder held by other Windows processes, even if it is being used by other processes.
This can be used in race condition situations where a process has opened a folder and it tries to delete it just before closing the original handle.
This function will close all the handles of all the processes that have opened the requested file or directory, thus it may cause unexpected behavior on other programs or could leave your file system on an inconsistent state. USE THIS UNDER YOUR OWN RISK.
In order to use force-delete-win
in your Rust library/program, you need to add
it as a dependency in your Cargo.toml:
[dependencies]
force-delete-win = 0.1
# To install from source
# force-delete-win = { git = "https://github.com/andfoy/force-delete-win" }
For using this package please do,
use std::ffi::OsString;
use force_delete_win::force_delete_file_folder;
fn my_func() -> Result<bool, String> {
let path = OsString::from(r"C:/my_path");
match force_delete_file_folder(path){
true => Ok(true), // The folder was deleted properly
false => Err("The folder wasn't deleted properly")
}
}
To run our tests, just open a terminal and run,
cargo test
Visit our CHANGELOG file to learn more about our new features and improvements.
We use cargo clippy
to lint this project and cargo test
to test the Rust components.
Feel free to send a PR or create an issue if you have any problem/question.