2014-07-21 06:12:49 +00:00
|
|
|
package weed_server
|
|
|
|
|
|
|
|
import (
|
2014-09-25 08:57:22 +00:00
|
|
|
"github.com/chrislusf/weed-fs/go/glog"
|
2014-07-21 06:12:49 +00:00
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
/*
|
|
|
|
Move a folder or a file, with 4 Use cases:
|
2014-07-21 06:17:29 +00:00
|
|
|
mv fromDir toNewDir
|
|
|
|
mv fromDir toOldDir
|
|
|
|
mv fromFile toDir
|
|
|
|
mv fromFile toFile
|
2014-07-21 06:12:49 +00:00
|
|
|
|
|
|
|
Wildcard is not supported.
|
|
|
|
|
|
|
|
*/
|
|
|
|
func (fs *FilerServer) moveHandler(w http.ResponseWriter, r *http.Request) {
|
|
|
|
from := r.FormValue("from")
|
|
|
|
to := r.FormValue("to")
|
|
|
|
err := fs.filer.Move(from, to)
|
|
|
|
if err != nil {
|
|
|
|
glog.V(4).Infoln("moving", from, "->", to, err.Error())
|
|
|
|
writeJsonError(w, r, err)
|
|
|
|
} else {
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
}
|
|
|
|
}
|