Schoolboy error - arrrggghhh!!!
So I downloaded some files to my home directory which were named similarly with the exception of the last part, eg screenshot1001.jog, screenshot1002.jpg and so on.. I had about 20 of these and wanted to delete them all, so I did "rm screenshot*".
However - that's not what I did!!! I stupidly, and for some reason unknown to man did "rm screenshot *"!!!!!! Lost a crap load of files from my home directory as a result!!! :( Anyone know how I might get these back (using ext4 filesystem)? I've tried extundelete but had no luck. Yes, I know I should probably alias rm to rm -i but I'm not a linux n00b and have been using it for years without any problem. I think only having four hours sleep last night didn't help either as I am not concentrating!! :( |
Never tried it but i have heard of test disk.
|
Moved: This thread is more suitable in <Linux - General> and has been moved accordingly to help your thread/question get the exposure it deserves.
|
Quote:
to "touch ./-i" ... works in most situations (unless you have other files in the dir by names of -[a-h]*). Cheers, Tink |
Hi,
Yes, I suppose that would have the same effect as alias'ing but only happens in chosen directories. I just find it too intrusive sometimes that's all but then again I guess I am never going to want to run "rm *" in my home dir! If I did want to remove using wildcards then it wouldn't be matched. Can I be sure that the -i file will always be hit first (ie, other files won't be deleted first)? I've also set up a cron job to backup /home weekly (will change to daily when I eventually get around to having an external file server) to a separate partition. I know it would be better doing a remote backup but unfortunately I don't have the facilities to do this. |
As i said with the "caveat" ... the * will (by default) glob files in ASCII
order. So if you have (other) files that start with unusual character they may get killed. So file names starting with Code:
040 SPACE Code:
-a Cheers, Tink |
On the bright side, you now understand the value of a back up and anyone else reading this who doesn't have a back up of things they care about will hopefully now understand why they should.
FWIW I've been using *nix command lines for about fifteen years and not only do I always make sure I have rm aliased to 'rm -i' but I also do it for cp and mv. Without -i, cp and mv will silently overwrite an existing file with the target name if it exists. Everyone makes a typo once in a while. I've lost files as the result of typos and that's why I now alias rm, cp and mv. If you want to delete a bunch of stuff without being asked you can always use -f. If you use -f read what you typed at least twice before hitting enter! |
Yep, definitely a valuable lesson. Like I say, I have been using linux for quite a few years now and use unix at work and have always been fine and usually check any such commands. It was just a costly mistake made I think because I wasn't concentrating properly! :(
Tinkster - I very rarely (in fact probably never) have filenames which start with anything other than an ascii character so i should be ok! :) |
All times are GMT -5. The time now is 07:37 PM. |