Skip to content

Instantly share code, notes, and snippets.

@fd0
Created May 18, 2017 18:03
Show Gist options
  • Save fd0/6ad6f434548337f785694d5d592caf9d to your computer and use it in GitHub Desktop.
Save fd0/6ad6f434548337f785694d5d592caf9d to your computer and use it in GitHub Desktop.
#!/bin/bash
snapshots=$(restic snapshots --json | jq --raw-output '.[].id')
for id in $snapshots; do
tree=$(restic cat snapshot $id | jq --raw-output .tree)
name=$(restic cat blob $tree | jq --raw-output '.nodes[0].name')
blobs=$(restic cat blob $tree | jq --compact-output '.nodes[0].content')
echo "{'id': '$id', 'name': '$name', 'content': $blobs}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment