I accidentally deleted the dir, /path/to/dir
, and all its contents from an application.
However, I still have a terminal window open, still cd
-ed in /path/to/dir
!
Q: Is there any way to recursively recover /path/to/dir
?
Note that lsof
gives me this:
$ lsof | egrep '/path/to'
bash 3113 hs cwd DIR 252,0 4096 42207179 /path/to
bash 3487 hs cwd DIR 252,0 0 42207253 /path/to/dir (deleted)
Further, if I do this...
$ ls /proc/3487/fd/
0 1 2 255
$ cd /tmp
$ dd if=/proc/3487/fd/255 of=recovered.dir bs=1M
... the dd
command just sits there doing nothing, with recovered.dir
's size not growing. I was assuming here that the process 3487 has the directory /path/to/dir
open at the file-descriptor 255, and so, if I dd
or cat
it, I would be able to recover the entire tree /path/to/dir
.
There are plenty of articles on the web on how to use lsof
to recover deleted regular files, but none for recovering deleted directories.
Would greatly appreciate a quick response!!