Score:1

Anyway to undo overwriting file by mv or recover replaced file?

mq flag

I accidentally mv a new file to an existing file and overwrote it. Is there anyway to undo mv or recover the replaced file?

Score:1
cn flag

The rm and mv and cp commands do not have an "undo" feature. They have some protections (like optional interactive confirmation).

If you mv a file or directory, it may be possible to recover the older contents using a data recovery application like testdisk or photorec. However, it requires learning and skill and patience to use those applications properly. Recovery is not easy and not certain. This is a last hope, and often forlorn.

Since all humans make mistakes, we encourage the use of backups to prevent frustration and despondence. Backups are much easier than data recovery.

Levente avatar
cn flag
"using a data recovery application like testdisk or photorec" — I would add that if OP indeed opts for such direction while not being familiar with these tools, then they would best need to shut down the PC, and use another OS on another disk to learn the operation of these recovery tools. (If available, booting from a Ubuntu Live USB is sufficient, as it, by default, leaves the internal disk alone.) The more usage the impacted disk sees after the problematic file operation, the more chance emerges that the desired data records will be further decimated, thus less hope remains for recovery.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.