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.

28 lines
553 B

11 years ago
  1. package weed_server
  2. import (
  3. "code.google.com/p/weed-fs/go/glog"
  4. "net/http"
  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, err)
  21. } else {
  22. w.WriteHeader(http.StatusOK)
  23. }
  24. }