You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
593 B

11 years ago
  1. package weed_server
  2. import (
  3. "net/http"
  4. "github.com/chrislusf/seaweedfs/weed/glog"
  5. )
  6. /*
  7. Move a folder or a file, with 4 Use cases:
  8. mv fromDir toNewDir
  9. mv fromDir toOldDir
  10. mv fromFile toDir
  11. mv fromFile toFile
  12. Wildcard is not supported.
  13. */
  14. func (fs *FilerServer) moveHandler(w http.ResponseWriter, r *http.Request) {
  15. from := r.FormValue("from")
  16. to := r.FormValue("to")
  17. err := fs.filer.Move(from, to)
  18. if err != nil {
  19. glog.V(4).Infoln("moving", from, "->", to, err.Error())
  20. writeJsonError(w, r, http.StatusInternalServerError, err)
  21. } else {
  22. w.WriteHeader(http.StatusOK)
  23. }
  24. }