summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2012-07-03 10:58:37 +1000
committerAmitay Isaacs <amitay@gmail.com>2012-07-03 15:20:41 +1000
commite3828d4ccb131750e0064f17ba599db5bd662753 (patch)
tree6d75c3cc483350b8f3014e99bb91e237a528974c /source4
parent807ff1e3432d85e19d753909c1cdd93a52cbc296 (diff)
downloadsamba-e3828d4ccb131750e0064f17ba599db5bd662753.tar.gz
samba-e3828d4ccb131750e0064f17ba599db5bd662753.tar.bz2
samba-e3828d4ccb131750e0064f17ba599db5bd662753.zip
s4-pysmb: Add deltree() method to remove directory and its contents
Thanks to Denis Bonnenfant <denis.bonnenfant@diderot.org> for patch.
Diffstat (limited to 'source4')
-rw-r--r--source4/libcli/pysmb.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source4/libcli/pysmb.c b/source4/libcli/pysmb.c
index 14b05f7994..1122305c28 100644
--- a/source4/libcli/pysmb.c
+++ b/source4/libcli/pysmb.c
@@ -263,6 +263,28 @@ static PyObject *py_smb_rmdir(pytalloc_Object *self, PyObject *args)
}
/*
+ * Remove a directory and all its contents
+ */
+static PyObject *py_smb_deltree(pytalloc_Object *self, PyObject *args)
+{
+ int status;
+ const char *dirname;
+ struct smb_private_data *spdata;
+
+ if (!PyArg_ParseTuple(args, "s:deltree", &dirname)) {
+ return NULL;
+ }
+
+ spdata = self->ptr;
+ status = smbcli_deltree(spdata->tree, dirname);
+ if (status <= 0) {
+ return NULL;
+ }
+
+ Py_RETURN_NONE;
+}
+
+/*
* Check existence of a path
*/
static PyObject *py_smb_chkpath(pytalloc_Object *self, PyObject *args)
@@ -526,6 +548,9 @@ static PyMethodDef py_smb_methods[] = {
{ "rmdir", (PyCFunction)py_smb_rmdir, METH_VARARGS,
"rmdir(path) -> None\n\n \
Delete a directory." },
+ { "deltree", (PyCFunction)py_smb_deltree, METH_VARARGS,
+ "deltree(path) -> None\n\n \
+ Delete a directory and all its contents." },
{ "chkpath", (PyCFunction)py_smb_chkpath, METH_VARARGS,
"chkpath(path) -> True or False\n\n \
Return true if path exists, false otherwise." },