How to recover files from a given directory using photorec

15,494

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.

Share:
15,494

Related videos on Youtube

Thanos
Author by

Thanos

I have just(October 2012) finished my undergraduate studies in Applied Physics(D.Sc., D.Eng.) at National Technical University of Athens(NTUA). My thesis was about the MicroMEGAS detector where I constructed, studied, simulated and analysed data. I have enrolled(October 2012) in a M.Sc. programm called Physics and Technological Applications (NTUA) and I hope to continue with a Ph.D. My working experience includes 7 years student's tutoring(university,high school, primary school), 1 year of developing laser systems on behalf of the NTUA Laser Group, 1 year of detector studies on behalf of the NTUA High Energy Physics Group(HEP-NTUA) and a month working at CERN on behalf of the RD51 collaboration, in detector RnD. My future plans include Ph.D studies in the USA or Europe in the field of experimental Physics(I should decide on which particular field), marrying my girlfriend and working in research. Other interests include culinary, pastry, photography, basketball, cinema, completing tutorial in various fields and computing. I am a new user of ubuntu(10.04 LTS)(since July 2012).

Updated on September 18, 2022

Comments

  • Thanos
    Thanos almost 2 years

    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?

    • alchemy
      alchemy about 4 years
      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