mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
add delete() method to ftp object
This commit is contained in:
parent
d9e9f9c05d
commit
a61bdeb8a9
1 changed files with 10 additions and 0 deletions
|
@ -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 == '..':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue