webdav: add Client.CopyAll

This commit is contained in:
Simon Ser 2020-01-22 10:16:48 +01:00
parent 489be203a1
commit 307a998a46
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48

View File

@ -187,6 +187,24 @@ func (c *Client) Mkdir(name string) error {
return err return err
} }
func (c *Client) CopyAll(name, dest string, overwrite bool) error {
req, err := c.ic.NewRequest("COPY", name, nil)
if err != nil {
return err
}
dest, err = c.ic.ResolveHref(dest)
if err != nil {
return err
}
req.Header.Set("Destination", dest)
req.Header.Set("Overwrite", internal.FormatOverwrite(overwrite))
_, err = c.ic.Do(req)
return err
}
func (c *Client) MoveAll(name, dest string, overwrite bool) error { func (c *Client) MoveAll(name, dest string, overwrite bool) error {
req, err := c.ic.NewRequest("MOVE", name, nil) req, err := c.ic.NewRequest("MOVE", name, nil)
if err != nil { if err != nil {