How I made file moves between drives undoable and verified in a Rust desktop app
Description and use
A Rust desktop app guarantees atomic, verified, and undoable file moves across drives, preventing incomplete copies and accidental deletions.
Problem
Moving movie files across multiple drives often left half‑finished copies and no way to undo the operation.
Outcome
The application now guarantees that file moves are atomic, verifiable, and reversible, eliminating half‑finished copies and accidental deletions.
Workflow
- 1. Write every planned move step to a SQLite journal before touching the disk.
- 2. Perform a pipelined copy using a reader/writer, flush buffers, read back past the OS cache, and compare SHA‑256 checksums.
- 3. Move the original files to the recycle bin/freedesktop trash using rename only, never copying.
- 4. Stage the new location in a temporary folder, then rename once the copy is verified.
- 5. Update the library to point to the new location.
- 6. Provide an undo feature that reverts moves based on the journal history.
- 7. Handle crashes mid‑move by replaying or rolling back journal entries.
Evidence
the problem: my movie library on several drives, moves that half-finish, no undo
journal first: write every planned step to SQLite before touching the disk
the copy: pipelined reader/writer, flush, read back past the OS cache, compare SHA-256
originals to the recycle bin / freedesktop trash (rename-only, never copied)
- Record date: 2026-11-01T05:13:55.685Z