Skip to content

Instantly share code, notes, and snippets.

View apan-liu's full-sized avatar

jacklsp apan-liu

View GitHub Profile
@apan-liu
apan-liu / ftprmtree.py
Created November 22, 2016 03:04 — forked from artlogic/ftprmtree.py
Python ftplib rmtree
def FtpRmTree(ftp, path):
"""Recursively delete a directory tree on a remote server."""
wd = ftp.pwd()
try:
names = ftp.nlst(path)
except ftplib.all_errors as e:
# some FTP servers complain when you try and list non-existent paths
_log.debug('FtpRmTree: Could not remove {0}: {1}'.format(path, e))
return