Find file versions

Is it there a way to show when single file are changed? For example if I wreck a file some backups ago how to find backup when file is changed?
I found similar question already but no proper answer and thread is pretty old.

I don’t know if this is the best way to do it, but I’d probably mount the repository using restic mount and then do something like ls -l /mnt/backups/snapshots/*/path/to/file.

This should give me a listing of every occurrence of that file in each snapshot (as long as the path is the same within the snapshots), and I could then look at the dates of it and see when it changes.

Note, I haven’t tested it, the above is just off the top of my head.

One other method would be also looping snapshot IDs for restic dump $snapshotID /path/to/file | md5sum and comparing the hashes.

But this method will fail if you’re including more than one path inside a snapshot, due to a bug in the last release. (This mr touches it, but not sure if it fixed this on master since I’ve not tested yet)

This is what works for me:
.$.$RESTICEXE find filename.ext -r $RESTIC_REPOSITORY --json
The --json gives more and detailed output then without this option. It gives output such as permissions but that doesn’t matter. The two important pieces of data are mtime, which should be the last modification date/time, and size! This info will be listed for each snapshot that you have so put the output into a file and perhaps reformat it with another program.
Hope this helps.

1 Like