jottacloud: add permanent delete support: --jottacloud-hard-delete

This commit is contained in:
albertony 2018-09-07 13:58:18 +02:00 committed by Nick Craig-Wood
parent 3fccce625c
commit e07a850be3
2 changed files with 27 additions and 3 deletions

View File

@ -72,6 +72,11 @@ func init() {
Help: "Files bigger than this will be cached on disk to calculate the MD5 if required.",
Default: fs.SizeSuffix(10 * 1024 * 1024),
Advanced: true,
}, {
Name: "hard_delete",
Help: "Delete files permanently rather than putting them into the trash.",
Default: false,
Advanced: true,
}},
})
}
@ -82,6 +87,7 @@ type Options struct {
Pass string `config:"pass"`
Mountpoint string `config:"mountpoint"`
MD5MemoryThreshold fs.SizeSuffix `config:"md5_memory_limit"`
HardDelete bool `config:"hard_delete"`
}
// Fs represents a remote jottacloud
@ -596,7 +602,11 @@ func (f *Fs) purgeCheck(dir string, check bool) (err error) {
NoResponse: true,
}
opts.Parameters.Set("dlDir", "true")
if f.opt.HardDelete {
opts.Parameters.Set("rmDir", "true")
} else {
opts.Parameters.Set("dlDir", "true")
}
var resp *http.Response
err = f.pacer.Call(func() (bool, error) {
@ -1015,7 +1025,11 @@ func (o *Object) Remove() error {
Parameters: url.Values{},
}
opts.Parameters.Set("dl", "true")
if o.fs.opt.HardDelete {
opts.Parameters.Set("rm", "true")
} else {
opts.Parameters.Set("dl", "true")
}
return o.fs.pacer.Call(func() (bool, error) {
resp, err := o.fs.srv.CallXML(&opts, nil, nil)

View File

@ -108,7 +108,11 @@ the `--jottacloud-md5-memory-limit` flag.
### Deleting files ###
Any files you delete with rclone will end up in the trash. Due to a lack of API documentation emptying the trash is currently only possible via the Jottacloud website.
By default rclone will send all files to the trash when deleting files.
Due to a lack of API documentation emptying the trash is currently
only possible via the Jottacloud website. If deleting permanently
is required then use the `--jottacloud-hard-delete` flag,
or set the equivalent environment variable.
### Versions ###
@ -139,6 +143,12 @@ system.
Files bigger than this will be cached on disk to calculate the MD5 if
required. (default 10M)
#### --jottacloud-hard-delete ####
Controls whether files are sent to the trash or deleted
permanently. Defaults to false, namely sending files to the trash.
Use `--jottacloud-hard-delete=true` to delete files permanently instead.
### Troubleshooting ###
Jottacloud exhibits some inconsistent behaviours regarding deleted files and folders which may cause Copy, Move and DirMove operations to previously deleted paths to fail. Emptying the trash should help in such cases.