I accidentally did a rm -rf data
in a huge directory. I exited immediately.
The directory has a simple structure (they are all date-keyed sub-directories, like 2015/07/06) but the directory is huge and I don't want to regenerate the whole thing. If I knew how rm
removed the files, I could find and regenerate just the missing ones.
How does rm -rf
go about deleting files?
rm
performs a depth-first search, walking the results of the xfts_open
call.
FTS is the standard means by which files are traversed in all the Linux tools. You can write your own fts consumer, or trust the output from find
, since it also uses xfts_open
.
find .
will list the files that exist. You can then use your knowledge of the expected structure to reverse the list that are missing.
Alternatively, you can use debugfs
to help you get at the files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With