Commit bcc1acf4 authored by dasharatha.vamshi's avatar dasharatha.vamshi

clean up FTP

parent 8dd9a999
......@@ -41,14 +41,16 @@ def remove(path, source_directory, ftp_host=FTP_HOST, ftp_user=FTP_USER, ftp_pas
ftp = SmartFTP(ftp_host, ftp_user, ftp_pass)
ftp.login(ftp_user, ftp_pass)
ftp.cwd(source_directory)
logger.info("changed directory to {}".format(source_directory))
ftp.delete(os.path.basename(path))
logger.info("changing directory to {}".format(source_directory))
logger.info("getting file list")
logger.info("removing ftp file {}".format(path))
logger.info("removed ftp file {}".format(path))
ftp.close()
return path
except:
except Exception as e:
if '550 Delete operation failed' in str(e):
logger.info(f"Skipping {path}")
else:
logger.error(f"Error when removing files from FTP location {source_directory} {e}", exc_info=enable_traceback)
if __name__ == "__main__":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment