How I made file moves between drives undoable and verified in a Rust desktop app
Описание и применение
Приложение на Rust обеспечивает атомарные, проверяемые и отменяемые перемещения файлов между дисками, предотвращая неполные копии и случайные удаления.
Задача
Moving movie files across multiple drives often left half‑finished copies and no way to undo the operation.
Результат
The application now guarantees that file moves are atomic, verifiable, and reversible, eliminating half‑finished copies and accidental deletions.
Рабочий процесс
- 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.
Доказательства
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)
- Дата записи: 2026-11-01T05:13:55.685Z