If you want to have more error control for your FTP script , you can
1) use a better FTP to offers you options such as debugging or verbose output.
2) use a better language such as Python(or Perl) which comes with FTP libraries with error control
from ftplib import FTP
import os
def upload(ftp, file): ftp.storbinary("STOR " + file, open(file, "rb"), 1024)
os.chdir("localpath")
ftp = FTP('localhost')
ftp.set_debuglevel(3) # <------------------------ set debugging mode.
try:
ftp.login("user","pass")
except Exception, e:
print "error ",e #<---------------------------- this part will execute is login fails
else:
for files in os.listdir("."):
if os.path.isfile(files):
upload(ftp,files)