Crates.io | ifop |
lib.rs | ifop |
version | 0.1.5 |
source | src |
created_at | 2024-01-21 13:52:58.757097 |
updated_at | 2024-01-23 05:44:07.406332 |
description | A simple to use IFileOperation command tool |
homepage | https://github.com/Larmian/ifop |
repository | https://github.com/Larmian/ifop |
max_upload_size | |
id | 1107641 |
size | 51,393 |
You can use this crate to copy|move|delete|rename file or folder like Explorer that.
When you move a file to another folder, then you can undo or redo in explorer.
Show progress window if this is big file.
The --flags
options Refer IFileOperation
::SetOperationFlags
$ cargo add ifop
Copy
single file// No flags
ifop::copy_file("c:\\src\\file.text", "c:\\dest", None).unwrap();
// With flags
ifop::copy_file("c:\\src\\file.text", "c:\\dest", Some(
windows::Win32::UI::Shell::FOF_ALLOWUNDO |
windows::Win32::UI::Shell::FOF_NORECURSION
)).unwrap();
Copy
multiple files// No flags
ifop::copy_files(vec!["c:\\src\\file1.txt", "c:\\src\\file2.txt"], "c:\\dest", None).unwrap();
// With flags
ifop::copy_files(vec!["c:\\src\\file1.txt", "c:\\src\\file2.txt"], "c:\\dest", Some(
windows::Win32::UI::Shell::FOF_ALLOWUNDO |
windows::Win32::UI::Shell::FOF_NORECURSION
)).unwrap();
Move
single file// No flags
ifop::move_file("c:\\src\\file.text", "c:\\dest", None).unwrap();
// With flags
ifop::move_file("c:\\src\\file.text", "c:\\dest", Some(
windows::Win32::UI::Shell::FOF_ALLOWUNDO |
windows::Win32::UI::Shell::FOF_NORECURSION
)).unwrap();
Move
multiple files// No flags
ifop::move_files(vec!["c:\\src\\file1.txt", "c:\\src\\file2.txt"], "c:\\dest", None).unwrap();
// With flags
ifop::move_files(vec!["c:\\src\\file1.txt", "c:\\src\\file2.txt"], "c:\\dest", Some(
windows::Win32::UI::Shell::FOF_ALLOWUNDO |
windows::Win32::UI::Shell::FOF_NORECURSION
)).unwrap();
Rename
single file// No flags
ifop::rename_file("c:\\src\\folder1", "folder2", None).unwrap();
// With flags
ifop::rename_file("c:\\src\\folder1", "folder2", Some(
windows::Win32::UI::Shell::FOF_ALLOWUNDO |
windows::Win32::UI::Shell::FOF_NORECURSION
)).unwrap();
Rename
multiple files// No flags
ifop::rename_files(vec!["c:\\src\\folder1\\file1.txt", "c:\\src\\folder2\\file2.txt"], "file3.txt", None).unwrap();
// With flags
ifop::rename_files(vec!["c:\\src\\folder1\\file1.txt", "c:\\src\\folder2\\file2.txt"], "file3.txt", Some(
windows::Win32::UI::Shell::FOF_ALLOWUNDO |
windows::Win32::UI::Shell::FOF_NORECURSION
)).unwrap();
Delete
single file// No flags
ifop::delete_file("c:\\src\\folder1", None).unwrap();
// With flags
ifop::delete_file("c:\\src\\folder1", Some(
windows::Win32::UI::Shell::FOF_ALLOWUNDO |
windows::Win32::UI::Shell::FOF_NORECURSION
)).unwrap();
Delete
multiple files// No flags
ifop::delete_files(vec!["c:\\src\\folder1\\file1.txt", "c:\\src\\folder2\\file2.txt"], None).unwrap();
// With flags
ifop::delete_files(vec!["c:\\src\\folder1\\file1.txt", "c:\\src\\folder2\\file2.txt"], Some(
windows::Win32::UI::Shell::FOF_ALLOWUNDO |
windows::Win32::UI::Shell::FOF_NORECURSION
)).unwrap();
// No flags
ifop::create_file("c:\\", "file.txt", None).unwrap();
// With flags
ifop::create_file("c:\\", "file.txt", Some(
windows::Win32::UI::Shell::FOF_ALLOWUNDO |
windows::Win32::UI::Shell::FOF_NORECURSION
)).unwrap();
// No flags
ifop::create_folder("c:\\", "folder", None).unwrap();
// With flags
ifop::create_folder("c:\\", "folder", Some(
windows::Win32::UI::Shell::FOF_ALLOWUNDO |
windows::Win32::UI::Shell::FOF_NORECURSION
)).unwrap();
Compile
cargo build --examples
cd target/debug/examples
Command examples
# Copy single file
ifop copy --src <filename|folder> --dest <folder>
# Copy multiple files
ifop copy --src <filename|folder>,<filename|folder>... --dest <folder>
# Move single file
ifop move --src <filename|folder> --dest <folder>
# Move multiple files
ifop move --src <filename|folder>,<filename|folder>... --dest <folder>
# Rename single file
ifop rename --src <filename|folder> --dest <folder>
# Rename multiple files
ifop rename --src <filename|folder>,<filename|folder>... --dest <folder>
# Delete single file
ifop delete --target <filename|folder>
# Delete multiple files
ifop delete --target <filename|folder>,<filename|folder>...
# Create file
ifop new-file --root <root_path> --name <name>
# Create folder
ifop new-folder --root <root_path> --name <name>
# With `--flags`
ifop <command> [options] --flags FOF_ALLOWUNDO|FOF_CONFIRMMOUSE|....
Commands:
copy Copy files from --src to --dest
delete Delete files from --target
rename Rename file from --src to --dest
move Move files from --src to --dest
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
-V, --version Print version
Support | Lower Version |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2008 [desktop apps only] |
Target Platform | Windows |