English / Deutsch | Print version
Twitter
twitter

<< Previous
Restore one file

Table of Contents

Next >>
Find the HFS+ Volume Header or Alternate Volume Header and the partition start offset

Restore files with a list


When you don't want to restore all files in step 3, then you can use a list of files that you want to restore. Use the parameter '--file-list <file name>'.

The list file has a simple format. At the beginning of the line is the file number (from --list or --csv), then comes a colon. After the colon can be any text. The text after the colon will be ignored.

Sample file with 10 files to restore:

1003:
283:
553:
18: live.1.shadowIndexHead, 4096 bytes, 1438688946, Tue Aug  4 13:49:06 2015, Start block 589824
19: live.2.directoryStoreFile, 4096 bytes, 1438688943, Tue Aug  4 13:49:03 2015, Start block 524338
20: live.2.directoryStoreFile.shadow, 1088 bytes, 1438688947, Tue Aug  4 13:49:07 2015, Start block 524374
21: live.2.indexArrays, 4096 bytes, 1438688947, Tue Aug  4 13:49:07 2015, Start block 524322
22: live.2.indexCompactDirectory, 1024 bytes, 1438688947, Tue Aug  4 13:49:07 2015, Start block 524321
450:
451:

With this function its easy to select files to restore or exclude files from restoring.

As step 4 restores the whole directory structure (even when you restore only a few files), can you use at the end after '-s6' the command 'hfsprescue --remove-empty-dirs' to remove the empty directories.


Example: Exclude files

This example shows how to exclude files with the extensions '.download' and '.part' from restoring.

hfsprescue --list | grep -v ".download, " | grep -v ".part, " > files.list

• 'grep' is used with '-v' to exclude the pattern from the output.
• As only files with the expected extensions should be excluded, the text ', ' is added at the end, because '--list' writes ', ' at the end of the file name.
• '>' creates a new file with the output of 'grep'.

The command of step 3: hfsprescue -s3 /dev/sdb1 --file-list files.list


Example: Restore files with modification dates

This example creates a list with files that have a modification date of 4., 5. and 12. August 2015.

hfsprescue --list | grep " Aug  4 " | grep " 2015, " > files.list
hfsprescue --list | grep " Aug  5 " | grep " 2015, " >> files.list
hfsprescue --list | grep " Aug 12 " | grep " 2015, " >> files.list

• 'grep' is used get the text with the pattern.
• Two 'grep' commands are used, because the year is interrupted from the month and day by the time.
• The first command with '>' creates a new file with the output of 'grep'.
• The other commands append with '>>' the output of 'grep' to the output file.

The command of step 3: hfsprescue -s3 /dev/sdb1 --file-list files.list


Example: Exclude files with 0 bytes

This example creates a list with files that are bigger than 0 bytes.

hfsprescue --list | grep -v ", 0 bytes, " > files.list

• 'grep' is used with '-v' to exclude the pattern from the output.
• '>' creates a new file with the output of 'grep'.

The command of step 3: hfsprescue -s3 /dev/sdb1 --file-list files.list




<< Previous
Restore one file

Table of Contents

Next >>
Find the HFS+ Volume Header or Alternate Volume Header and the partition start offset


© 2016 by Elmar Hanlhofer