Well fuck.
I’m one fell swoop, I managed to delete 1.7TB of data from my media streaming PC. I was trying to do something that would save me a few MB, if that, and fix a minor source of irritation. It ended up biting me quite stupendously in the ass.
Note to future self. When using Linux 1-liners,please be wary of positional arguments and always RTFM!
find /multimedia -name *.txt -delete
: removes all text files found under path /multimedia
find -delete /multimedia -name *.txt
: removes 1.7 TB of data
From the find(1) man:
Warnings: Don’t forget that the find command line is evaluated as an expression, so putting -delete first will make find try to delete everything below the starting points you specified.
And then you cry.
But what about your backup, you ask? Well, I do have one, but it’s 6-month out of date, which is not a major thing, and it’s also currently in a location that is difficult to access. Alternative measures are being taken to restore the data.
It’s not a critical loss. I’ll get most, if not all, the data back. Its just incredibly frustrating and involved a serious sphincter-clench, followed by an Oh-shit-I’m-stupid moment I could have done without.