mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-23 00:34:23 +00:00
webdav: add Client.CopyAll
This commit is contained in:
parent
489be203a1
commit
307a998a46
18
client.go
18
client.go
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user