Dolphin goes one step further, if you say yes to the confirmation dialog, it shows an additional one: "The file (copy) was copied from (original), but since then it has apparently been modified at (time). Undoing the copy will delete the file, and all modifications will be lost. Are you sure you want to delete (copy)?"
The last post of Adventures in Linux and KDE is a good example of this: https://pointieststick.com/2023/05/11/plasma-6-better-defaul...
This has bitten me more than once. Does anyone actually want this behavior?
For the longest time, Excel had its own windowing system within the app. It's only recently that the Office team saw the light and let the whole OS called Windows control window management in Excel.
Very useful when you need to copy multiple separate strings without going back and forth between windows. I've caught myself doing optimistic copying - if I see something that i might need to paste in the future, like git commit hashes, file names, etc. I just copy them all and store them in the clipboard list.
I think there is a program "clipmenu" which does this for X11, but haven't used it too much.
It just needs to be designed very carefully and not be actionable by mistake without confirmation.
It's been a thing as far back as I can remember.
The worst part is when you don't remember what the last thing you moved was. You know you've undone something, but you don't know what it is.
Is something going to be broken now?
Are you going to lose something that's now in a place where you weren't expecting it to be any more?
Good luck figuring it out!
I think this mistake is usually recoverable in Windows, but
For decades, there have been other stupid annoyances with Windows Explorer such not providing options in 'Copy' to allow the automatic renaming of files in cases where the destination contains files of the same name. It stands to reason that there'll be occasions when one doesn't want to overwrite destination files.
For years, I often wondered about how Microsoft employees actually use the stuff they create—or if they use it at all.
How can they continue to use a 'nobbled' Windows when they have the power to actually fix these annoyances? It sort of defies all logic and reason.
Does anyone know the reason?
In a large company, just because you use something, develops it, and is on the specification process, it still doesn't mean you have the power to actually fix anything.
The problem here is that "undo copy" acted as "undo paste", a ridiculous bug.
Undo copy should only remove the copied thing from the clipboard.
This has saved me from a few accidental unrecoverable changes.
git reflog is also your friend.
And Vim will also let you go back to any prior state as long as you still have the file open. You can go back to a specific date/time, revert the last 5 minutes etc.
These tools rely on the fact that Windows (and most other operating systems) don't zero out the filesystem when deleting files. This means that the file contents are still there, all you're really missing is the reference to the file contents.
As long as the disk doesn't get overwritten, the files can be saved. The more surefire way to recover files is to stop writing to the drive as soon as you notice your mistake. If you want to use your existing OS for file recovery (much easier, but less likely to succeed) you will need to kill any program running and start a recovery program as soon as possible. Chances are you can't mark the drive you saved the file to as read-only, so speed and luck are essential. It helps to have a file recovery tool installed already, so you don't have to download and install one, increasing the probability of overwriting your precious file contents.
Using easy tools like Recuva and some other paid software, you can often get files back, not only from the original location but also temp files that may have been left behind during editing.
The most reliable way I know involves a Linux recovery disk. It's not exactly beginner friendly, but even moderate knowledge of Linux and the command line can save you hours of work.
The most surefire way I know to recover files is to kill the machine (pull the plug, hold down the power button, etc., so the shutdown process can't write any new files) and to boot into a live Linux distro packing recovery tools. Kali has a bunch, but there are others as well. Make sure not to mount the drive read-write (you probably can't get it to mount automatically after a forced shutdown anyway) so it doesn't corrupt your files and then run recovery software.
Testdisk [1] can often find deleted files, though it's built to recover partitions more than it was made to recover files.
ntfsundelete[2] is a command line tool that was made to find files that were likely to be deleted. It's especially useful if you know the name of the file you're trying to recover.
foremost[3] and its fork scalpel [4] are command line forensic recovery tools originally written by a member of the USAF Office of Special Investigations. They're not as well-maintained as some other tools but they're very versatile if your file format may not be recognized by other tools.
Finally there's Sleuthkit [5], a file recovery tool that will run from Linux leveraging other file recovery tools as well as its own forensic recovery tools, bundled together with a nice GUI. This too was designed for forensic analysis more than anything, but the GUI can help avoid tedious command line work.
With bigger files this becomes harder, because the file may be fragmented and because the larger the file, the higher the probability that new files have been written on top of the old file contents.
For Bitlocker encrypted drives, you'll need to use a tool like dislocker[6]. Make sure to mount data read only though, because Bitlocker is proprietary and reverse engineered tools have a habit of corrupting data when writing to disk.
[1] https://www.cgsecurity.org/wiki/TestDisk
[2] https://linux.die.net/man/8/ntfsundelete
[3] https://foremost.sourceforge.net/
Edit: Actually read the entire page this time and there's indeed a registry edit to disable it, but it disables every other type of undo as well which isn't ideal.
The article explains how to:
"Is there a way to prevent this?
Yes. Just disable this silly feature using the Windows Registry.
Create a DWORD entry named MaxUndoItems with a value of 0 under:
HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced
Alternatively you can run this equivalent command:
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v MaxUndoItems /d 0 /t REG_DWORD /f
Log off or restart and the context menu option will be gone. The associated shortcut (Ctrl-Z) will be disabled too (note that this only applies to Explorer, Ctrl-Z will still work in other programs)."
If you undo copy that file you will find it in your onedrive history.
I’m not saying cloud storage isn’t a good idea as well. But it solves a slightly different problem while creating new ones (needing a Microsoft account, needing an internet connection, files being suitable for cloud storage, etc).
Edit: I think I got this wrong. Most likely, this is due to some "Undo <action>" always being displayed.
It is a fantasy because seemingly stupid stuff often has relatively good reasons to exist, but boy would I have a field day at most big tech companies.
I am a terribly slow typist, so this is a habit I formed many years ago.
That's why, by now, Microsoft should have recognized that such incidents happen and responded by building in protections into Windows to avoid them.