#!/usr/bin/python
# -*- coding: utf-8 -*-s
import os  # directory methods
import sys
import datetime
import sys
import ftplib
import socket
import struct
import fcntl

# Use this Remove images from FTP server.
# Pass the file name as the argument to the script
# Called from CMD.HTML Link

ftpOn='true'
ftpPath = r"/"
ftpU="ENTER_YOUR_FTP_USERNAME"
ftpP="ENTER_YOUR_FTP_PASSWORD"
ftpHost="ENTER YOUR FTP HOSTNAME (and port if different)"

def ftpCall(filename):
    if (ftpOn == 'true'):
        try:
            ftp = ftplib.FTP(ftpHost)
            ftp.login(ftpU, ftpP)
            ftp.cwd(ftpPath)
            ftp.delete(filename)
            print("[pdrop ftp delete ok]")
            ftp.close()
        except ftplib.all_errors as e:
            print "%s" % e
if (len(sys.argv) > 1):
    ftpCall(sys.argv[1])
    print "Done"
else :
    print "Request arg"

