Skip to content

Instantly share code, notes, and snippets.

@filiperfernandes
Last active November 21, 2018 14:47
Show Gist options
  • Save filiperfernandes/d70b5bda962103b6b1620698cf5dfc1d to your computer and use it in GitHub Desktop.
Save filiperfernandes/d70b5bda962103b6b1620698cf5dfc1d to your computer and use it in GitHub Desktop.
Recover multiple files with icat
# First get list of files:
# fls -f ext4 -o 2048 -p -r ./image_disk 573445 | grep -v '^..-' | grep -v '^... \*' > files.lst
IMAGE=image_disk
LIST=files.lst
DEST=/path/to/output/dir
cat $LIST | while read line; do
filetype=`echo "$line" | awk {'print $1'}`
filenode=`echo "$line" | awk {'print $2'}`
filenode=${filenode%:}
filename=`echo "$line" | cut -f 2 | grep -v " "`
if [ $filetype == "r/r" ]; then
echo "$filename"
mkdir -p "`dirname "$DEST/$filename"`"
icat -f ext4 -o 2048 -r -s "$IMAGE" "$filenode" > "$DEST/$filename"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment