Retrieve File From Borg Backup

Retrieve File From Borg Backup

I need to retrieve a music file who’s hash has changed on my laptop and I’m not sure why.

I know the exact path but lets pretend I don’t:
borg list borg:borg-repo/

Which lists all the backups I’ve made, I want the latest music one which happens to be Music-2016-04-27

I can use borg list borg:borg-repo/::Music-2016-04-27 to list all files in that backup.
The file I want is called 03 Liberty Bell.m4a

borg list borg:borg-repo/::Music-2016-04-27 | grep "03 Liberty Bell.m4a" will show me where the file is.

borg extract is what we want to use

Lets extract the file:
borg extract "$REPO::$BACKUP" Users/steven/Music/iTunes/iTunes Media/Music/Fatty Gets a Stylist/Fatty Gets a Stylist/03 Liberty Bell.m4a"

Borg will extract to the current directory so make sure you cd where you need to be beforehand.

The file will be found under cd Users/steven/Music/iTunes/iTunes\ Media/Music/Fatty\ Gets\ a\ Stylist/Fatty\ Gets\ a\ Stylist/03\ Liberty\ Bell.m4a

Run borg help patterns to understand how to better use paths when extracting data from backups.

Leave a Reply

Your email address will not be published. Required fields are marked *