1
0
mirror of https://github.com/samba-team/samba.git synced 2025-11-06 08:23:50 +03:00

s4-pysmb: Add deltree() method to remove directory and its contents

Thanks to Denis Bonnenfant <denis.bonnenfant@diderot.org> for patch.
This commit is contained in:
Amitay Isaacs
2012-07-03 10:58:37 +10:00
parent 807ff1e343
commit e3828d4ccb

View File

@@ -262,6 +262,28 @@ static PyObject *py_smb_rmdir(pytalloc_Object *self, PyObject *args)
Py_RETURN_NONE;
}
/*
* 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
*/
@@ -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." },