In Windows Explorer, the last operation can be undone by either right-clicking an empty area and clicking ‘Undo …’ or pressing the keyboard shortcut CTRL + ‘Z’. Like undoing an unintended change in a Word document, this can be very handy for undoing renaming the wrong file without remembering what it was originally called, undoing moving a file to a wrong folder and so on.
However, when copying files from external media, the undo feature can lead to a nasty surprise where it permanently deletes the copied files. Normally this is not a problem if the external media is not wiped, but the issue silently occur if the user accidentally repeats an undo operation to undo something else or holds down the keyboard shortcut CTRL + ‘Z’ too long, performing all the undo operations since the user logged in.
Consider the following example, carried out in Windows 10 – I copied some pictures from a memory card:
Now I format the memory card in the camera. At this point, the pictures are now only on my PC.
Now suppose later on I accidentally rename a file to ‘#’. This can easily happen here with the ‘#’ key being right next to the Enter key on Irish/UK keyboards:
To undo that mistake, I press CTRL + ‘Z’. So what happens if I accidentally press CTRL + ‘Z’ a second time or even held CTRL + ‘Z’ long enough for it to repeat?
At this point, nothing obvious has happened other than that ‘#.jpg’ file being renamed back to the original file name.
Now let’s go back to the folder where I copied the pictures to from the memory card:
Where did they go? Let’s check the Recycle Bin:
That second undo operation undone copying those files. Unlike deleting files with the ‘Delete’ key or icon, undoing a file copy operation will permanently delete the copied files. So what happens if I try right-clicking an empty area and clicking ‘Redo Copy’?
Now I have a problem, the memory card has been formatted…
Indeed, this can just as easily happen if an entire memory card of pictures were copied to the computer and the card is then wiped. If the user is lucky, they may be able to get their pictures back with a file recovery tool, but this may not be possible if the pictures were copied from a phone.
So when copying pictures from a memory card, reboot the computer or log out to clear the undo history before formatting the memory card or erasing pictures from the phone or media they were copied from.
Update: This issue does not occur in Windows 7. In Windows 7, undoing a copy operation will display a warning screen that files are about to be permanently deleted. I do not have a Windows 8 based computer handy to check whether Windows 8 is affected.
Update #2: I have now checked with Windows 8.1 and it is affected. Like Windows 10, it does not display a warning when undoing a file copy operation.