This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ftplib import FTP, error_perm | |
import os.path, os | |
def remove_ftp_dir(ftp, path): | |
"""Recursively delete all files and directories within the given directory on the FTP server.""" | |
for (name, properties) in ftp.mlsd(path=path): | |
print(name) | |
if name in ['.', '..'] or name.startswith(".") or name.startswith(".."): | |
continue | |
elif properties['type'] == 'file': |