]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
add delete() method to ftp object
authorGuido van Rossum <guido@python.org>
Wed, 11 Oct 1995 17:36:31 +0000 (17:36 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 11 Oct 1995 17:36:31 +0000 (17:36 +0000)
Lib/ftplib.py

index 6a36df47041fa32523a79992b9d9461ef9bfcdf7..0dc0d6e649daaa57495bd650909b90828c127027 100644 (file)
@@ -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 == '..':