The problem#
Last week, I shared a script which continuously backed up game saves whenever the game saved. The result is a series of directories that contain snapshots of the game saves from every autosave. But to view this data, we really want a list of unique files in order marked with the time they were created.
The solution#
The following will create symbolic links to the unique files named after their modification date:
for i in /tank/factorio/.zfs/snapshot/*/*.zip
do
ln -sf "$i" "$(stat --printf=%y "$i").zip"
done
or if you want a custom date format, you can use date
:
ln -sf "$i" "$(date -r "$i" +%Y-%m-%d_%H-%M-%S).zip"
Alternatively, the following will just list the unique files with their timestamps:
find /tank/factorio/.zfs/snapshot/ -printf "%T+ %p\n" \
| sort | uniq --check-chars=30