add delete() method to ftp object

This commit is contained in:
Guido van Rossum 1995-10-11 17:36:31 +00:00
parent d9e9f9c05d
commit a61bdeb8a9

View 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 == '..':