From a61bdeb8a99585d51052e1e6f02d9883542daa59 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 11 Oct 1995 17:36:31 +0000 Subject: add delete() method to ftp object --- Lib/ftplib.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 == '..': -- cgit v0.12