A fast file manager for Windows and macOS that never freezes: tabs, dual panes, archives as folders, Quick Look-style previews. A File Explorer and Finder alternative written in Rust.
Rust archive-managerdesktop-appdual-paneexplorer-alternativefile-browserfile-explorerfile-managerfluent-designgpu-acceleratedgpuimacosmicaproductivityquick-lookrustrust-guitabswindowswindows-11windows-explorer
//! Times a same-drive move of many small files into a subfolder of a big folder, through the
//! fast engine and with a plain loop of renames, without the window around it.
//! `cargo run --release -p rf-win --example move_many -- <scratch dir> [files to move] [other files]`
use std::path::PathBuf;
use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use std::time::Instant;
use rf_win::fileops::{Tracker, Transfer};
fn main() {
let mut args = std::env::args().skip(1);
let root = PathBuf::from(args.next().expect("scratch dir"));
let moved: usize = args.next().and_then(|a| a.parse().ok()).unwrap_or(10_000);
let others: usize = args.next().and_then(|a| a.parse().ok()).unwrap_or(50_000);
for engine in ["raw", "fast"] {
let big = root.join(format!("big-{engine}"));
let _ = std::fs::remove_dir_all(&big);
std::fs::create_dir_all(&big).unwrap();
for i in 0..400 {
std::fs::create_dir(big.join(format!("sub {i:03}"))).unwrap();
}
for i in 0..others {
std::fs::write(big.join(format!("other {i:06}.png")), [0u8; 512]).unwrap();
}
let mut sources = Vec::with_capacity(moved);
for i in 0..moved {
let p = big.join(format!("pic {i:06}.png"));
std::fs::write(&p, [0u8; 512]).unwrap();
sources.push(p);
}
let dest = big.join("target");
std::fs::create_dir(&dest).unwrap();
let tracker = Arc::new(Tracker::new(Box::new(|_, _, _| {}), Arc::new(AtomicBool::new(false))));
let t = Instant::now();
let ok = match engine {
"fast" => rf_win::fastcopy::transfer(Transfer::Move, &sources, &dest, tracker).unwrap(),
"raw" => {
let _ = tracker;
for s in &sources {
std::fs::rename(s, dest.join(s.file_name().unwrap())).unwrap();
}
true
}
_ => rf_win::fileops::transfer_tracked(Transfer::Move, &sources, &dest, tracker).unwrap(),
};
let n = std::fs::read_dir(&dest).unwrap().count();
println!("{engine}: moved {n}/{moved} in {:.2} s (ok {ok})", t.elapsed().as_secs_f64());
let _ = std::fs::remove_dir_all(&big);
}
}