summaryrefslogtreecommitdiffstats
path: root/Lib/ftplib.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-10-11 17:36:31 (GMT)
committerGuido van Rossum <guido@python.org>1995-10-11 17:36:31 (GMT)
commita61bdeb8a99585d51052e1e6f02d9883542daa59 (patch)
treed0e98f3057587109392d2a878c9ea4fc9ab78903 /Lib/ftplib.py
parentd9e9f9c05d705715826c84006054e7434a3c37ce (diff)
downloadcpython-a61bdeb8a99585d51052e1e6f02d9883542daa59.zip
cpython-a61bdeb8a99585d51052e1e6f02d9883542daa59.tar.gz
cpython-a61bdeb8a99585d51052e1e6f02d9883542daa59.tar.bz2
add delete() method to ftp object
Diffstat (limited to 'Lib/ftplib.py')
-rw-r--r--Lib/ftplib.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index 6a36df4..0dc0d6e 100644
--- a/Lib/ftplib.py
+++ b/Lib/ftplib.py
@@ -358,6 +358,16 @@ class FTP:
raise error_reply, resp
self.voidcmd('RNTO ' + toname)
+ # Delete a file
+ def delete(self, filename):
+ resp = self.sendcmd('DELE ' + filename)
+ if resp[:3] == '250':
+ return
+ elif resp[:1] == '5':
+ raise error_perm, resp
+ else:
+ raise error_reply, resp
+
# Change to a directory
def cwd(self, dirname):
if dirname == '..':