rmdir 目錄名
delete 文件名
ftp.rmd(目錄名)
ftp.delete(文件名)
from ftplib import FTP ftp = FTP(host=xx, user=xx, passwd=xx) ftp.cwd(dirname) for i in ftp.nlst(): print(i) ftp.delete(i) ftp.cwd("..") ftp.dir() ftp.rmd(dirname)