I've spent the last months building Folia Files, a file manager for macOS. The hardest part wasn't the interface. It was making every copy, move, rename and trash undoable, even hours later, without the app ever being the reason someone loses a file. Here's what I learned. Most of it applies to any tool that touches files, on any OS.
1. Never overwrite in place. When a copy replaces an existing file, write the new one next to it under a hidden temporary name first. Only once it's complete does the old file go to the Trash, and the new one takes its place with an exclusive rename (one that fails instead of overwriting if something appeared there in the meantime). If the copy fails or is cancelled halfway, the old file is untouched.
2. Undo is a promise you sometimes have to refuse. Undoing a copy means removing the copy. But if you edited that copy after the operation, removing it destroys your work. So record what each operation left behind (size, modification date down to the fraction of a second, number of items in a folder) and refuse the undo if it changed, saying why. A refused undo is annoying; a silent loss is unforgivable. And undo never deletes anything: the copy goes to the Trash.
3. Compare identities, not paths. "Is this folder inside itself?" and "is this the same file?" look like string checks, and they break on symlinks, case-insensitive disks, /tmp vs /private/tmp and macOS firmlinks. Compare device and inode numbers instead.
4. A move across disks is a copy plus a delete, and the delete is the dangerous half. Don't remove the source folder in one go based on the list you made before copying: a file can land in it during a long copy. Remove only what the destination really has (same size and date, or verified), entry by entry, and tell the user what stayed.
5. Some folders must never be replaced or trashed, even when the user asks. Disks, the home folder and its standard folders, system folders. Fun fact: on macOS, ~/Documents carries a "deny delete" ACL, so a recursive delete empties it and then fails on the folder itself.
6. Cloud-synced folders see your half-written files. Copy a large file into an iCloud Drive or Dropbox folder by writing it in place, and the sync client can upload the empty or partial file, then keep both versions. iCloud Drive did exactly that to me: ten empty "name 2" files next to the good ones. Write the file elsewhere on the same disk and rename it into place in one step.
7. Undo shouldn't add history. Undo and redo should mark an entry as undone or redone, not add new "Undo of…" entries, or the history becomes unreadable after a few back-and-forths.
The screenshots, in order: the operations history (each entry has its own Undo), one window split into several panes, the Branches view (folders laid out as a map), and a search that finds the text inside scans and screenshots.
All of this lives in Folia Files: that operations history, as many panes as you want in one window, 10 views, search inside documents and images, and servers and clouds mounted as disks. It's macOS only (14 or later, Apple silicon and Intel), signed and notarized by Apple, no account, no analytics.
It's $49.99 once for up to 3 Macs, every update included, no subscription. This week it's 30% off for Black Friday ($34.99 until November 29, applied at checkout, no code needed), and there's a 7-day free trial of everything: https://foliafiles.com/?ref=r-software
I'm the developer. Happy to go deeper on any of these, and curious how others handle undo in their file tools.