5

I want to recover some files using PhotoRec. Although I've used it before, I am not familiar with making it look only in one given directory.

Any idea how to do it?

Thanos
  • 447
  • Using TestDisk, click through device and type to Advanced.. in partition selection, pay attention to the bottom for Undelete. Then select a different drive to save to. I believe its possible to write a script using fls from TestDisk to recover from a single directory if that is needed or when the TD single selection is tedious.. see this answer here: unix.stackexchange.com/a/390174/346155 – alchemy Apr 30 '20 at 18:10

1 Answers1

8

It is not possible to scan directories for lost files using PhotoRec unless you had mounted a whole hard drive partition as this directory.

For Unix a directory entry is not much more than a file used for mapping inodes. This also is why PhotoRec can not recover the directory structure. It really is only to scan whole drives or partitions to then recover the content of files of a given type (as defined by known headers). Filenames and directory structures can not be recovered.

You may however use TestDisk from the same suite to search for directory entries, and then to recover files within these (see my answer there on how to do that). To use TestDisk we need remnants of the filesystem to be accessible still.

Takkat
  • 142,284