miracle2k/tarsnapper

Date-time confusion

ArthurClemens opened this issue · 2 comments

I have a bunch of test files, named like this:

test-20141025-163600.txt
test-20141025-164600.txt
test-20141025-165600.txt
test-20141025-170600.txt

This is my job configuration:

  test-txt:
    source: /home/backup/
    alias: test
    target: test-$date.txt
    deltas: 1h 1d 3d

I would expect that this reads the filename "test-" + date 20141025-163600 + ".txt". But when calling make I get:

Creating backup test-txt: test-20141025-204440.txt

It discards the time value in the file name and inserts the current time of the machine. It also creates only 1 backup file. This seems like a bug to me.

I think you're misunderstanding what $date does, it always expands to the current date/time in UTC. Your configuration will create an archive called test-20141025-204440.txt (since that's what you specified as target). The archive will contain your .txt files:

$ tarsnap tf test-txt-20141025-204440.txt
home/backup/test-20141025-163600.txt
home/backup/test-20141025-164600.txt
home/backup/test-20141025-165600.txt
home/backup/test-20141025-170600.txt

You could then restore e.g. test-20141025-163600.txt from the archive using:

$ tarsnap xf test-txt-20141025-204440.txt home/backup/test-20141025-163600.txt

Note that test-txt-20141025-204440.txt here is the name of the archive. What you specify in target has no relation to the names of the local files, it's just the name you want to give the archive that is created on Tarsnap. So perhaps better call your archive test-txt-backups-$date or something.

Hope this clears things up.

Thanks for clearing that up. I will have to find another solution.