Ledge

How to undo a file move you did by dragging

If you just dragged a file somewhere you did not mean to, click the Desktop or any Finder window to make Finder the front app and press Command-Z. Finder keeps a history of what it moved, and the file goes back to the folder it came from. The catch is that this only works while Finder still remembers the move, and only for things Finder itself did.

What Command-Z actually reverses

Finder’s undo covers the file operations Finder performs: moving, copying, renaming, creating a folder, applying a tag, and putting an item in the Trash. Press Command-Z more than once and it walks back through recent actions in order.

There are real limits worth knowing before you rely on it.

  • Finder has to be the active app. Command-Z in a browser undoes something in the browser. Click the Desktop first, or click a Finder window, then press it.
  • The history is per session and it is short. Restarting Finder or logging out clears it. After a stretch of other work, the move you want may have scrolled out of reach.
  • It does not reverse what another app did. If a download manager or an app moved a file on its own, Finder never saw it and has nothing to undo.
  • A copy across volumes is not always undone the same way. Dragging to an external drive or a network share makes a copy. Undo usually removes the new copy, but confirm the file is still at the source before assuming it worked.

If you also want to know how to stop a drag before it lands rather than reverse it afterward, how to cancel a drag on a Mac before you drop it covers pressing Escape mid-drag.

Finding a file you dropped somewhere unknown

Sometimes the problem is not undoing the move, it is that you have no idea where the file went. A drag that ends over a random Finder window or a folder icon can put a file two levels deep in something you were not looking at.

  1. Open the Recents item in the Finder sidebar. It lists files by the time they were last touched, newest first, which usually puts the file you just moved at the top.
  2. Check File, then Recent Items in the app that made the file, if an app created it.
  3. Search by date rather than by name. In a Finder window press Command-F, click the plus at the right of the criteria bar, and add Last modified date is today. That finds the file even if you cannot remember what it is called.
  4. Select the file and press Command-I. The Where line in the info panel shows the full folder path. Command-click the file’s name in the title bar of a document window for the same information as a menu of folders.

Once you have found it, drag it back or use cut and paste: Command-C to copy, then Command-Option-V in the destination to move it rather than duplicate it.

When undo will not help and Time Machine will

Two situations are outside Finder’s undo entirely.

You overwrote a file. Dropping a file into a folder that already has one with the same name prompts you to Keep Both, Stop, or Replace. If you chose Replace, the old version is gone from that folder and Command-Z does not bring it back. If you have a backup set up, open the folder in Finder and enter Time Machine to step back to a version from before the replacement.

The move happened a while ago. Once Finder’s history is cleared, restoring from a backup is the reliable route. Time Machine keeps the folder structure, so browse to the folder as it looked yesterday and restore the file from there.

This is also the reason to pause on the Replace button. Keep Both costs you a duplicate you can delete in ten seconds; Replace costs you a file.

The habit that prevents most accidental moves

Most bad drops share a cause: the drag was long, it crossed several windows, and the drop happened where the finger gave out rather than where the file belonged. On a laptop trackpad, a drag from a Downloads window across to a folder on the far side of the screen passes over half a dozen possible targets, any one of which will happily take the file.

Shortening the drag removes the risk. Two short, deliberate movements are safer than one long one across a crowded screen.

Ledge is built around that split. Drag a file up to the notch at the top of a MacBook screen and let go, and it lands on a shelf that stays there until you take it somewhere. The first move is short and the target is large. Then close the windows you do not need, open the destination folder properly, bring up the shelf with Option-Space or by clicking the notch, and drag the file off with the target in plain sight. On a Mac without a notch, the shelf sits at the top center of the screen and works the same way.

Because the item waits on the shelf rather than being committed somewhere the moment you let go, there is no move to undo if you change your mind about the destination. Ledge hands each destination the form it can use as well, so the same item becomes a file in Finder, a path in text in a terminal, or an upload in a chat app. Everything stays on your Mac; there is no account and nothing is uploaded. Picking up a file now and deciding where it goes later covers the wider pattern.

Questions

Does Command-Z in Finder undo emptying the Trash?

No. Emptying the Trash is permanent. Command-Z does undo putting something into the Trash, which is the step just before, so use it immediately if you binned the wrong item.

Can I undo a file move from the Terminal?

Not with a keystroke. A move done with a command is just a rename at the file system level, and there is no history to walk back. You have to move the file back yourself, which is one reason to double-check paths before pressing Return.

Why did undo restore the file but leave the copy in place?

You dragged across volumes, so the operation was a copy rather than a move. The original never left, and undo removed the new copy. If you still see two, delete the one you do not want.

Is there a way to see what Finder will undo?

Look at the Edit menu in Finder. The first item spells out the action, for example Undo Move of “report.pdf”. If it says only Undo, or the item is dimmed, Finder has nothing queued for you.