ftp automation

ScriptFTP

The professional tool to automate FTP, SFTP, FTPS and schedule FTP batch jobs

The forum is now read only. Please, go to the the main ScriptFTP website if you need help.
Need help writing a script? Have any question about ScriptFTP?
I added a label at the end of my script basically in the same form as I've seen in the examples... Now I get the error "End" expected.... Must be missing something somewhere, but it tells me it's the first column of line 149
and looks like this:
:kill
^


Any help would be appreciated!

Thanks.
Code: Select all# Enable verbose mode VERBOSE(ON) # Concatenate "BACKUP", the current date and ".txt" to build the log file name $logfile="C:\ftplogs\ftplog.txt" # Start logging LOGTO($logfile) # md5 sums to text file #EXEC("C:\Documents and Settings\Administrator\Desktop\md5.bat") # This is a label. It marks a point in the script. # We will use it to return to this point if a # connection attempt fails. # Shows a message PRINT("_____Connecting_____") # Connect to server. The return value of OPENHOST # is stored in $result $result=OPENHOST("ipaddy","username","password") # Check if $result is different from "OK" IF($result!="OK") PRINT("Cannot connect! Exiting.") # Jump to the label :connect to Exit         # the connection     EXEC("c:\documents and settings\administrator\desktop\transferissue.bat") EXIT END IF # Change Remote Directory CHDIR("/cps") # Connect to server. The return value of CHDIR # is stored in $result $result=CHDIR("/cps") # Check if $result is different from "OK" IF($result!="OK") PRINT("Cannot Change Remote Dir Exiting.") # Jump to the label :kill to exit         # the connection     EXEC("c:\documents and settings\administrator\desktop\transferissue.bat") EXIT END IF #Navigate to Local Dir LOCALCHDIR("c:\Video") # Get the local file listing, store it in $list GETLIST($list,LOCAL_FILES,"*.mpg") # For each file in $list... FOREACH $file IN $list # try to upload the file     $result=PUTFILE($file)         # If failed try again     IF($result!="OK")         $result=PUTFILE($file)    END IF # Transfer finished, close the connection CLOSEHOST #Move Files and Send Uploaded Report EXEC("C:\Documents and Settings\Administrator\Desktop\moveNEmailipvod.bat") # Shows a message PRINT("_____Connecting_____") # Connect to server. The return value of OPENHOST # is stored in $result $result=OPENHOST("ipaddy","username","password") # Check if $result is different from "OK" IF($result!="OK") PRINT("Cannot connect! Exiting.") # Jump to the label :connect to exit         # the connection     EXEC("c:\documents and settings\administrator\desktop\transferissue.bat") EXIT END IF # Change Remote Directory CHDIR("/encoded2") $result=CHDIR("/encoded2") # Check if $result is different from "OK" IF($result!="OK") PRINT("Cannot Change Remote Dir Exiting.") # Jump to the label :kill to retry         # the connection     EXEC("c:\documents and settings\administrator\desktop\transferissue.bat") EXIT END IF #Navigate to Local Dir LOCALCHDIR("c:\Video") # For each file in $list... FOREACH $file IN $list # try to upload the file     $result=PUTFILE($file)         # If failed try again     IF($result!="OK")         $result=PUTFILE($file)    END IF # For each file in $list... FOREACH $file IN $list # try to delete the file     $result=DELETEFILE($file)         # If failed try again     IF($result!="OK")         $result=DELETEFILE($file)    END IF # upload md5 report PUTFILE("C:\Video\MD5.txt") # Transfer finished, close the connection CLOSEHOST EXEC("c:\documents and settings\administrator\desktop\updatestoragelist.bat") EXEC("c:\documents and settings\administrator\desktop\UpdateVideoFolder.bat") EXIT :kill EXIT  
You are missing an END FOREACH statement after each FOREACH. That'll get the script running.

Also:

I don't see any GOTO statements in your script, that's how the script would know to get to a label. You have your :kill label above a redundant EXIT at the end of the script. Remove the second EXIT and put :kill about the first one.

Also, you have a couple areas where you:
Code: Select allCHDIR("/cps") # Connect to server. The return value of CHDIR # is stored in $result $result=CHDIR("/cps")
that's redundant, the script is changing directories twice. instead all you need is:
Code: Select all$result=CHDIR("/cps")
I got the script running with those changes made.
Thank you! this worked grandly after the mentioned changes.

I knewit was something simple that I was missing, but after going over it and over it you miss things. haha

Thanks again.
Thanks a lot forest :D