Gregwar/fatcat

Scan directories only

gitqlt opened this issue · 2 comments

Besides -x mode (-x <directory>: extract all files to a directory) I suggest implementing a very similar scan functionality (the switch might be -X or something).
In this mode the program would walk through the entries similarly, but instead of extracting all the files, it would

  • print only the pure directory tree (names, cluster numbers)
  • create them as well, if the optional targetdir argument would exist (-X [directory]).

I think recovering the full directory-tree can be very useful in cases when only some of the directories contain important files. Also, with my damaged image, the extracting crashed in some folders, which prevented me to get the whole directory-tree in one stage.

Hello,

Why not
But maybe we should investigate why it crashed as well to prevent this from happening

Hello, thank you for answering.

Regarding the crash, I found the followings with my damaged image.
(I have to keep that image private, sorry...).

I use fatcat v1.0.6.
It seems that when a subdirectory contain file(s) with no filename (and/or pointing to cluster 0), recovering them results in crash. Like here in the listings:

f 0/0/1980 00:00:00                                 c=0 s=2 (2B)

or:

Listing cluster 914
Directory cluster: 914
d 6/1/2019 00:14:20  ./                             c=914
d 6/1/2019 00:14:20  ../                            c=912
f 0/0/1980 02:00:00                                 c=0 s=0 (0B)
f 0/0/1980 00:00:00                                 c=0 s=0 (0B)

The recovery gives:

Extracting /Android/data/com.dropbox.android/files/.@ to
/var/tmp/resc/Android/data/com.dropbox.android/files/.@
bash: segmentation fault (core dumped)  fatcat /tmp/sdh.img -O 1048576 -x /var/tmp/resc

in gdb:
Program received signal SIGSEGV, Segmentation fault. _IO_new_fclose (fp=0x0) at iofclose.c:48 48 iofclose.c: No such file or directory. (gdb)

I hope that this helps you to fix. Anyway, this program is lifesaving! Thanks for it.