You are not logged in.
Hey everyone and happy new year
,
a friend of mine had already her first new year disaster.
Her plan was to recursively replace all occurrences of '?' in all filenames with a space character.
She used the following command to rename the files:
find /home/ruth/Desktop -depth -name '*?*' -execdir bash -c 'mv -- "$1" "${1//?/ }"' bash {} \;which was inspired by this post
However, since she is a casual user, she wasn't aware of the fact that '?' is a special character. So, what happened is that almost all files and folders (probably in the hundreds) have been renamed to a variable length of spaces. The backup situation is far from ideal, unfortunately, so recovering the files from that is not an option.
I don't have much hope, but is there anything we could do, to recover the old filenames? What would help already is some way to display a compact preview for a large range of filetypes. Nemo seems to display previews (icon view) only for images and pdfs, but not for office documents for instance.
She uses linux mind (I'm using archlinux, so it's more natural for me to ask here). The root filesystem is ext4 with no separate home partition.
Best,
SchimpansenMann
Offline
This does not just erase filenames, but also the files themselves. Given any number of files with same filename length in one directory, only one survives. (mv bar foo, mv baz foo -> then bar is gone as there is only one foo). If this is on SSD storage you should disable trim (fstrim.timer, or chmod -x /usr/bin/fstrim) ASAP or it will discard file contents on the next run...
It's probably hard if not impossible to recover filenames. As the filename length stayed the same the filename might have been changed in-place...
You should backup what is left. For each directory and filename length, that one file is what you still got intact (sans filename - you can use 'file thefile' to try and determine file type by content, so you can give each remaining file some name + extension until you figure out by content what it could have been)
Other than that, testdisk/photorec (on a raw image or overlay https://raid.wiki.kernel.org/index.php/ … erlay_file ) is probably the only thing you can do here.
Good luck...
Last edited by frostschutz (2020-01-01 15:49:16)
Offline
1. stop writing to that disk, mount it read-only /only/ (the more you use it the more damage you cause)
2. from eg. a live distro (do not boot the OS on that disk!) try http://ext4magic.sourceforge.net/ext4magic_en.html - since you mounted the disk read-only, you'll recover to yet another disk.
3. pray
Offline
Thanks for your input frostschutz and seth.
We will try that.
Best,
Sebastian
Offline