Add support for lost files
This commit is contained in:
parent
b477c898ce
commit
c0c8368012
2 changed files with 10 additions and 5 deletions
10
README.md
10
README.md
|
@ -5,14 +5,16 @@ Seafile Recovery.
|
|||
|
||||
Usage:
|
||||
seafile_recovery [--storage=<sto>] head <repoid>
|
||||
seafile_recovery [--storage=<sto>] ls <repoid> <pathid>
|
||||
seafile_recovery [--storage=<sto>] dump <repoid> <pathid>
|
||||
seafile_recovery [--storage=<sto>] s3 <repoid> <pathid> <bucket>
|
||||
seafile_recovery [--storage=<sto>] ls <repoid> (--dir=<dirid> | --file=<fileid>)
|
||||
seafile_recovery [--storage=<sto>] cp <repoid> (--dir=<dirid> | --file=<fileid>)
|
||||
seafile_recovery [--storage=<sto>] s3 <repoid> (--dir=<dirid> | --file=<pathid>) <s3url>
|
||||
seafile_recovery (-h | --help)
|
||||
|
||||
Options:
|
||||
-h --help Show this screen
|
||||
-h --help Show this screen
|
||||
--storage=<sto> Set Seafile storage path [default: ./storage]
|
||||
--dir=<dirid> Seafile Directory ID, can be obtained from commits as RootID
|
||||
--file=<fileid> Seafile File ID, can be obtained through ls
|
||||
```
|
||||
|
||||
## Dev notes
|
||||
|
|
5
fs.go
5
fs.go
|
@ -108,6 +108,7 @@ func (dn* DirNode) Parse() {
|
|||
jdec := json.NewDecoder(zfile)
|
||||
err = jdec.Decode(&dn.Elem)
|
||||
if err != nil { log.Fatal(err) }
|
||||
|
||||
}
|
||||
|
||||
func (fn* FileNode) Parse() {
|
||||
|
@ -130,7 +131,9 @@ func (dn* DirNode) Children() ([]*DirNode, []*FileNode) {
|
|||
files := make([]*FileNode, 0)
|
||||
|
||||
for _, el := range dn.Elem.Entries {
|
||||
if IsDir(el.Mode) {
|
||||
if el.Id == "0000000000000000000000000000000000000000" {
|
||||
log.Println("[Lost] "+dn.AbsolutePath+el.Name)
|
||||
} else if IsDir(el.Mode) {
|
||||
folders = append(folders, NewDirNode(dn, el))
|
||||
} else if IsRegular(el.Mode) {
|
||||
files = append(files, NewFileNode(dn, el))
|
||||
|
|
Loading…
Reference in a new issue