request, and this same cap is returned in the response body.
The default behavior is to overwrite any existing object at the same
- location. To prevent this (and make the operation return an error instead of
- overwriting), add a "replace=false" argument, as "?t=uri&replace=false". With
- replace=false, this operation will return an HTTP 409 "Conflict" error if
- there is already an object at the given location, rather than overwriting the
- existing object. Note that "true", "t", and "1" are all synonyms for "True",
- and "false", "f", and "0" are synonyms for "False". the parameter is
- case-insensitive. If you want this behavior only if there is an existing
- directory at the same location (that is, you want the operation to return an
- error if there is a directory at the same name, but to succeed if there is a
- file), add a "replace=only-files" argument, as "?t=uri&replace=only-files".
+ location. To prevent this (and make the operation return an error instead
+ of overwriting), add a "replace=false" argument, as "?t=uri&replace=false".
+ With replace=false, this operation will return an HTTP 409 "Conflict" error
+ if there is already an object at the given location, rather than
+ overwriting the existing object. To allow the operation to overwrite a
+ file, but return an error when trying to overwrite a directory, use
+ "replace=only-files" (this behavior is closer to the traditional unix "mv"
+ command). Note that "true", "t", and "1" are all synonyms for "True", and
+ "false", "f", and "0" are synonyms for "False", and the parameter is
+ case-insensitive.
=== Deleting a File or Directory ===
/uri/$DIRCAP/[SUBDIRS../]", it is likely that the parent directory will
already exist.
+ This accepts the same replace= argument as POST t=upload.
+
=== Deleting A Child ===
POST /uri/$DIRCAP/[SUBDIRS../]?t=delete&name=CHILDNAME
self.do_cli("cp", fn1, "tahoe:"))
d.addCallback(lambda res:
self.do_cli("cp", fn2, "tahoe:"))
- # do mv file1 file3
+
+ # do mv file1 file3
# (we should be able to rename files)
d.addCallback(lambda res:
self.do_cli("mv", "tahoe:file1", "tahoe:file3"))
d.addCallback(lambda (rc, out, err):
self.failUnlessIn("OK", out, "mv didn't rename a file"))
+
# do mv file3 file2
# (This should succeed without issue)
d.addCallback(lambda res:
# Out should contain "OK" to show that the transfer worked.
d.addCallback(lambda (rc,out,err):
self.failUnlessIn("OK", out, "mv didn't output OK after mving"))
+
# Next, make a remote directory.
d.addCallback(lambda res:
self.do_cli("mkdir", "tahoe:directory"))
+
# mv file2 directory
- # (should fail with a descriptive error message; the CLI mv
+ # (should fail with a descriptive error message; the CLI mv
# client should support this)
d.addCallback(lambda res:
self.do_cli("mv", "tahoe:file2", "tahoe:directory"))
self.failUnlessIn(
"Error: You can't overwrite a directory with a file", err,
"mv shouldn't overwrite directories" ))
+
# mv file2 directory/
# (should succeed by making file2 a child node of directory)
d.addCallback(lambda res:
d.addCallback(lambda (rc, out, err):
self.failUnlessIn("404", err,
"mv left the source file intact"))
+
# Let's build:
# directory/directory2/some_file
# directory3
self.do_cli("cp", fn2, "tahoe:directory/directory2/some_file"))
d.addCallback(lambda res:
self.do_cli("mkdir", "tahoe:directory3"))
+
# Let's now try to mv directory/directory2/some_file to
# directory3/some_file
d.addCallback(lambda res: