only list files? #8222
-
I am trying to create a function to restore a random file from a random repository, but the problem im running into is that i sometimes get a directory instead of a file to restore. i wrote a function in Go that uses borg list, but i'm unable to figure out how to only list files, is there anyone who can help me with this? I'm fairly new at Golang, but if its not possible with borg itself, then maybe someone can point me a bit in the right direction? :) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
You can not tell borg to only list regular files and not directories. But you can modify the way the borg list output looks like using the |
Beta Was this translation helpful? Give feedback.
-
Thanks for answering. I have looked at that page ofcourse :) But i dont understand how i would use mode, the examples only show {mode} so i assume i could not use {mode:file} ? I think i understand it. i could use {mode} and then filter out the lines that start with d |
Beta Was this translation helpful? Give feedback.
-
No, you just use |
Beta Was this translation helpful? Give feedback.
No, you just use
--format="{type} {mode} {path}{NL}
to list the mode also and then your code has to analyse the file mode or type.