Hello,
I need help writing script where I can continously check for a file on the remote host. If host doesn't have a file disconnect the session. If the host does have file download the file.
Any help would be kindly appreciated.
Cheers
I need help writing script where I can continously check for a file on the remote host. If host doesn't have a file disconnect the session. If the host does have file download the file.
Any help would be kindly appreciated.
Cheers
Great site!
found my answer, here is how i did it.
found my answer, here is how i did it.
Code: Select all
# Get the remote file listing, store it in $list
GETLIST($list,REMOTE_FILES)
# For each file in $list...
FOREACH $item IN $list
# Download the file
 $result=GETFILE($item)
# If the file has been downloaded successfully
    # delete the remote copy. Else stop the script.
 IF($result=="OK")
 DELETEFILE($item)
   GOTO:CONTINUE Â
 ELSE
 STOP
   GOTO:ALT   Â
 END IF
END FOREACH
:ALT
CLOSEHOST
EXIT
:CONTINUE
#Wait 10 Seconds
SLEEP(10)
#Copy files from Download folder to Backup folder
EXEC("copy C:\test\download\*.* C:\test\backup")
Hello Luke
There is another way:
There is another way:
Code: Select all
:start
# Get the remote file listing, filter it to the
# files that match the file name "thefile.txt"
GETLIST($list,REMOTE_FILES,"thefile.txt")
IF(COUNTELEMENTS($list)==1)
PRINT("The file exists")
ELSE
PRINT("The file does NOT exist")
END IF
# Wait for 10 seconds
SLEEP(10)
# Jump to the start of the script
GOTO :start
liked Script FTP? Try our other product Email Parser