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?
This is the script it's a complex One
I check for a flag >> $modez="NO"
Exist if so, goto :NXT0
I got this error
Running D:\UTL\tq.ftp
***** Script error on line 69, column 1: "end" expected
:NXT0
^

THE SCRIPT BELOW:
Code: Select all#be sure your FTP surpport MODE Z , if so change to YES #be sure your FTP surpport MODE Z , if NOT change to NO $modez="NO" #open a FTP access to a FTP site $result=OPENHOST("ftpSITE","name","pw") #log the result LOGTO("D:\scriptftp-".GETTIME(FORMAT2).".txt") #set the connection SETPORT(21) SETTIMEOUT(30) SETTYPE(BINARY) VERBOSE(OFF) SETSPEED(500) SETPASSIVE(ENABLED) #if connection not work to to :END LABEL IF($result!="OK")  GOTO :END END IF #if the local folder not exist goto :END LABEL $result=LOCALCHDIR("D:\dnews\BAG\temp") IF($result!="OK")  GOTO :END END IF #if the remote folder not exist goto :END LABEL $result=CHDIR("uucp_bag_files/outgoing") IF($result!="OK")  GOTO :END END IF #if get list files *.gz $result=GETLIST($list,REMOTE_FILES,"*.gz") #if not exist goto label :END IF($result!="OK")  GOTO :END END IF FOREACH $item IN $list #if files are bigger 10megs just flag them   $FLAG=0 $filezise_in_bytes=GETFILESIZE(REMOTE,$item) IF($filezise_in_bytes>10480000) DELETEFILE($item) $FLAG=1 END IF #calculate files extention $A = TEXTLENGTH($item)-3 $B = TEXTLENGTH($item) - "A$" $exT=TEXTCUT($item,$A,TEXTLENGTH($item)) # ----------------------------------------------------     # this FLAG is to toggle the Bypass the check if Ext to On/off the MODEZ IF ($modez=="NO") goto :NXT0 END IF # if extention are upper or lower case, handle it  IF (($EXT==".RAR") OR ($EXT==".GZ") OR ($EXT==".rar") OR ($EXT==".gz"))  SETMODEZ(OFF)  ELSE  SETMODEZ(ON)  END IF :NXT0 # it make a ERROR HERE , WHY i do not KNOWN !!!!!!!! could be because it in a >FOREACH    # ----------------------------------------------------    #if file not flag to big, get them, after delete it  IF ($FLAG==0) $result=GETFILE($item) IF($result=="OK")  DELETEFILE($item) ELSE  GOTO :END END IF  END IF END FOREACH :END CLOSEHOST #this will Un-rar or UN-GZ files automaticly #it's external bat files EXEC("d:\utl\un-gzip.bat") #this will delete file older of 2 days EXEC("d:\utl\del-bag.bat") #remove the temporairy files .part make by Scriptftp if a prob Obscur EXEC("if exist D:\dnews\BAG\TEMP\*.part del /F /Q D:\dnews\BAG\TEMP\*.part")
Hello Floffy,

Yes, you are right. Labels are not allowed inside FOREACH, IF, or WHILE, sorry.
Hello Floffy,

Yes, you are right. Labels are not allowed inside FOREACH, IF, or WHILE, sorry.

well, fine that will not stop the script working