Restic find --newest: wrong number of arguments

I can run restic find pattern without problem.

I want to add more options to the command, but I just can’t figure out how to use them.

For example when I run /usr/bin/restic --verbose=2 --cleanup-cache find --newest bashrc I get an error:

$ restic find --newest bashrc
Repository: rclone:sftp:/home/remoteuser/repository/directory
Fatal: wrong number of arguments

I works if I use other option: restic find --long bashrc

I’m using 0.9.5:

$ /usr/bin/restic version
restic 0.9.5 compiled with go1.12.2 on linux/amd64

What am I missing here ?

See restic find --help
Both flags, newest as well as oldest, require you to enter a string in the form of a date or time and then you provide the search query.

  -N, --newest string   newest modification date/time
  -O, --oldest string   oldest modification date/time

I am not quiet sure yet what the format would be of the date/time string.

But if you want to search for that file only in the latest snapshot, you simply can put the ID of the snapshot in the find command.

I did see the help, but it’s not clear what “string” is. I was thinking it was the search pattern.

I did few try using a date format YYYY-MM-DD and I was able to get some results.

  • --oldest: It seems to return match not older than the specified date
$ restic find --long --oldest 2019-09-01 bashrc
repository 8fe564d8 opened successfully, password is correct

Found matching entries in snapshot 13268788
-rw-rw-r--  1000  1000   7825 2019-10-02 20:28:05 /home/username/.dotfiles/bashrc

Found matching entries in snapshot 55ae89ed
-rw-rw-r--  1000  1000   7804 2019-09-24 21:01:14 /home/username/.dotfiles/bashrc

Found matching entries in snapshot 69e29919
-rw-rw-r--  1000  1000   8098 2019-10-18 20:27:57 /home/username/.dotfiles/bashrc

Found matching entries in snapshot 9ab24880
-rw-rw-r--  1000  1000   8024 2019-10-22 19:10:47 /home/username/.dotfiles/bashrc

Found matching entries in snapshot a15379cb
-rw-rw-r--  1000  1000   7766 2019-09-23 19:01:34 /home/username/.dotfiles/bashrc

Found matching entries in snapshot b7a4e597
-rw-rw-r--  1000  1000   7825 2019-10-02 20:28:05 /home/username/.dotfiles/bashrc

Found matching entries in snapshot c8d50926
-rw-rw-r--  1000  1000   8098 2019-10-18 20:27:57 /home/username/.dotfiles/bashr
  • --newest: It seems to return match not newer than the specified date
$ restic find --long --newest 2019-04-01 bashrc
repository 8fe564d8 opened successfully, password is correct
Found matching entries in snapshot 10190d7b
-rw-rw-r--  1000  1000   7284 2019-03-23 09:46:54 /home/username/.dotfiles/bashrc

Found matching entries in snapshot 3a98dd04
-rw-rw-r--  1000  1000   7284 2019-03-23 09:46:54 /home/username/.dotfiles/bashrc

Found matching entries in snapshot 684e2622
-rw-rw-r--  1000  1000   7284 2019-03-23 09:46:54 /home/username/.dotfiles/bashrc

Found matching entries in snapshot 71814742
-rw-rw-r--  1000  1000   7284 2019-03-23 09:46:54 /home/username/.dotfiles/bashrc

Found matching entries in snapshot ba1c40a7
-rw-rw-r--  1000  1000   7284 2019-03-23 09:46:54 /home/username/.dotfiles/bashrc

Found matching entries in snapshot e31ce0fc
-rw-rw-r--  1000  1000   7284 2019-03-23 09:46:54 /home/username/.dotfiles/bashrc

Expected date format seems to be the one I used. I tried with YYYY/MM/DD, but it failed with Fatal: unable to parse time: "2019/04/01"

I’m not sure if my understanding of each parameter is correct. Hopefully someone will be able to confirm. Also some clarification in the doc/help would be great.

I believe it would be RFC8601 or RFC3339 (which is similar) to pass the date and time - just because that’s what my gut tells me fd0 would use ^^
So / won’t work then.

You’re definitely are more than welcome to write some doc and make a PR to add it :slight_smile:
It would most certainly be beneficial to have something which explains this feature.

I can give a try at update the doc. Is there a “guide” I can follow to do it ?