|
Answer» hi i have write following ftp script to upload file in server
username pass bin hash prompt lcd filepath mput *.* this is text file to name test and BATCH file is
ftp -s:test.txt servername exit
the script is ok but i have crate log file to the output of how to run of this bat file can any one help thanks is advanceCode: [Select]>>Logfile.txt Put that at the end of your lines to go to that.thank for replay but this is not work the error is invalid commandput it at the end of your ftp command.yes i have write the end of the line but the error is invalid command
username pass bin hash prompt lcd filepath mput *.* >>logfile.txtIf 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 Code: [Select]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) Quote from: rihan on March 18, 2009, 09:16:32 PM yes i have write the end of the line but the error is invalid command
username pass bin hash prompt lcd filepath mput *.* >>logfile.txt
at the end of your ftp command:
Quote from: rihan on March 17, 2009, 10:30:58 PMftp -s:test.txt servername >> logfile.txt
|