Hi there,
I searched on the forum but could not find what I'm looking for and also not sure if it is possible what I'm looking for.
I want to set a download limit but for files. So say download 100 files only, finished, close session. Is there a way with FTPScript?
Thanks.
AAHendriks.
I searched on the forum but could not find what I'm looking for and also not sure if it is possible what I'm looking for.
I want to set a download limit but for files. So say download 100 files only, finished, close session. Is there a way with FTPScript?
Thanks.
AAHendriks.
Hello,
Yes, it is possible in most cases. Could you post your script file to show you where you have to add a variable that works as download counter?
Yes, it is possible in most cases. Could you post your script file to show you where you have to add a variable that works as download counter?
liked Script FTP? Try our other product Email Parser
Hi there,
Sorry for the delay due busy period. Here is a part of the script wherein I want to set a download limit. I'm not sure if it needs to be set under the command GETLIST or under GET. Maybe you can give me some advice on this? Thanks.
Cheers.
Albert.
Sorry for the delay due busy period. Here is a part of the script wherein I want to set a download limit. I'm not sure if it needs to be set under the command GETLIST or under GET. Maybe you can give me some advice on this? Thanks.
Cheers.
Albert.
Code: Select all
# Get file list
$result=GETLIST($list,REMOTE_FILES,"*.*")
IF($result!="OK")
PRINT("Cannot connect to remote folder. Sending an email and aborting in 5 seconds.")
SILENT(ON)
EXEC($blat_cmd_line_4)
SILENT(OFF)
SLEEP(5)
END IF
# Copy and Delete files, one by one
FOREACH $item IN $list
$result=GETFILE($item)
IF($result=="OK")
DELETEFILE($item)
ELSE
PRINT("Can not download files. Sending an email and aborting in 5 seconds.")
SILENT(ON)
EXEC($blat_cmd_line_5)
SILENT(OFF)
SLEEP(5)
END IF
END FOREACH
Â
Hi Albert,
You have to add a variable to count the times a file has been succesfully downloaded in the FOREACH loop:
You have to add a variable to count the times a file has been succesfully downloaded in the FOREACH loop:
Code: Select all
# ----------- Added by ScriptFTP support
# Set the initial value of the download counter
$counter=0
# ------------------------------
FOREACH $item IN $list
$result=GETFILE($item)
IF($result=="OK")
DELETEFILE($item)
# ----------- Added by ScriptFTP support
$counter=$counter+1
# ------------------------------
ELSE
PRINT("Can not download files. Sending an email and aborting in 5 seconds.")
SILENT(ON)
EXEC($blat_cmd_line_5)
SILENT(OFF)
SLEEP(5)
END IF
# ----------- Added by ScriptFTP support
# If $counter has reached 100 stop the script
IF($counter==100)
STOP
END IF
# -----------------------------
END FOREACH
liked Script FTP? Try our other product Email Parser
Thanks, it works perfectly.
liked Script FTP? Try our other product Email Parser
- All times are UTC -