Have you ever accidentally deleted an important file or dragged it into the wrong folder while cleaning up your desktop? You don’t have to search through the Recycle Bin or dig through folders one by one. There is a way to revert it back in just one second. What is this magic key combination?
At a Glance
- Accidental deletion, move, or rename:
Ctrl + Z(or right-click and choose ‘Undo’)- Redoing an undone action:
Ctrl + Y(orCtrl + Shift + Z)- Cannot be restored if: Permanently deleted using
Shift + Delete, or executed after disconnecting/formatting an external drive
The Undo Shortcut You Use in Documents Also Works in Folders

Just like erasing a typo with a pencil eraser while writing, the most familiar shortcut when using a computer is Ctrl + Z.
Most users believe this shortcut only works inside word processors or spreadsheet programs like Word and Excel. However, it works exactly the same way in File Explorer and on the desktop in Windows 10 and Windows 11.
If you accidentally dragged a file into another folder, renamed a file by mistake, or pressed the Delete key, pressing Ctrl + Z instantly cancels the action you just performed. If using the keyboard is inconvenient, right-clicking on an empty space in the folder and selecting ‘Undo’ will restore the file just the same.
Actions You Can Undo and How to Redo Them

Windows File Explorer temporarily keeps a history of your recent file operations in memory. Thanks to this feature, you can restore files to their previous state without the hassle of opening the Recycle Bin.
| Mistake Made | Result of Pressing Ctrl + Z |
|---|---|
| Accidental file deletion (moved to Recycle Bin) | Instantly restored to its original folder location |
| Accidental move via mouse drag | File automatically returns to its original folder |
| Mistaken file rename | Reverts to previous file name |
| Unnecessary duplicate copy created | Instantly deletes the newly created copy |
If you pressed Undo too many times and reverted actions you wanted to keep, simply press the Redo shortcut, Ctrl + Y. Depending on the specific software environment, Ctrl + Shift + Z may also be used.
When It Won’t Work: Important Warnings

This shortcut does not solve every issue. Files permanently deleted with Shift + Delete without going through the Recycle Bin cannot be recovered using Ctrl + Z.
Extreme care is also required when handling external media. If you copy or move files from a USB flash drive or SD card to your PC, and then press Ctrl + Z after disconnecting or formatting the external device, the copied file on your PC will be removed and cannot return to the original source, creating a risk of permanent data loss.
For reference, while Microsoft Office is known to support up to 100 undo steps, the exact limit of actions File Explorer keeps in RAM is not stated in official documentation. In addition, closing the File Explorer window completely or restarting your computer clears the operation history, so it is safest to press the shortcut immediately after a mistake happens.
If a file disappears after an accidental click or drag on your desktop, do not panic—press Ctrl + Z on your keyboard right away.
References
1-Minute Video Summary
Related Posts
- Why Clicking the Middle Mouse Wheel Opens and Closes Browser Tabs in 1 Second Without Right-Clicking
- How to Switch Between Duplicate and Extend Displays in 1 Second Using Win + P When Connecting a Monitor or Projector
- Can’t Find Your Mouse Pointer on a Large High-Res Screen? How to Make It Neon and Shake to Locate in Windows
