Good Day,
is there any kind of a --depth switch for ls command in restic which I’m overlooking?
Thanks for Help!
Good Day,
is there any kind of a --depth switch for ls command in restic which I’m overlooking?
Thanks for Help!
What are you trying to do/accomplish? Please be more specific.
I want to display a compact list of folders in my repo, so i can quickly see whats in.
As Example, when i backup a Firefox and Thunderbird folder, the full path is
“C:\Users\user\AppData\Roaming\Mozilla” and “C:\Users\user\AppData\Roaming\Thunderbird” following by thousands of Files.
What i want, is that restic shows me only the specific depth of a Path, not the Files.
“C:\Users\user\AppData\Roaming\Mozilla” and so on…
I hope you know what i mean
Providing a specific path to restic ls
as an argument might do some of what you want.
When given a path, restic ls
doesn’t recurse. So restic ls /home <snapshot_id_here>
would print the listing of all the directories/files in /home, and nothing about the contents of any subdirectories.
If you were looking for an equivalent to the --max-depth
switch for du
though, I’m not aware of one. An alternative solution for that could be to restic mount
the repository and then parse the snapshot contents using your tool of choice.
See How to override folder with backup - #2 by gurkan and Restore only subtree of snapshot via <hash>:<subtree> syntax · Issue #3871 · restic/restic · GitHub which would propose the syntax restic ls <snapshots_id_here>:/home
.
And feel free to try out rustic (I’m the author) which does already implement this syntax for ls
, restore
and diff
.
Regarding the original question about ls --depth
: This is not yet implemented, but if you open an issue, maybe it gets implemented…
Thanks @ all,
I’m on Windows, so no “mount” for me
Giving “ls” an absolute Path is a good hint, thanks!
But an ls --depth switch would be pretty nice
Came here to suggest this but then found this post. And then I was wondering what the --recursive
switch was for. It seems to recurse with or without the switch? If it didn’t, this would pretty much solve the problem. Am I missing something? restic ls <snapshot-ID> /Users
and restic ls <snapshot-ID> /Users --recursive
seems to do the same thing?
Just gave it a try and for me the --recursive
flag does what it’s supposed to:
❯ restic ls d3e05ec9 --recursive /restic | wc -l
11568
❯ restic ls d3e05ec9 /restic | wc -l
29
(and yes, I’ve used a backup of the restic repository for testing)