Is there any kind of a --depth switch for ls command?

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 :slight_smile:

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.

1 Like

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 :frowning:

Giving “ls” an absolute Path is a good hint, thanks!

But an ls --depth switch would be pretty nice :slight_smile: