Is there a script that will automatically download files as they become available? I monitor a site and when a file is uploaded I need to immediately download the file. Normally I would set a variable for the file size and then recheck the file size every 15 seconds or so and if the file size has not changed then I assume the file is ready for download.
Can I accomplish this in ScriptFTP?
Thanks
Can I accomplish this in ScriptFTP?
Thanks
Hello Danyul,
ScriptFTP has no way to check file sizes yet but you can use the SYNC command to download every new or modified file this way:
ScriptFTP has no way to check file sizes yet but you can use the SYNC command to download every new or modified file this way:
Code: Select all
A new command to get file sizes will be added soon.WHILE("TRUE")
IF(SYNC("C:\local_dir","/myremotedir",DOWNLOAD,SUBDIRS)!="OK")
PRINT("Synchronization error. Exiting")
# Wait for 10 seconds
SLEEP(15)
ELSE
PRINT("All new or modified files downloaded. Waiting 10 seconds")
SLEEP(15)
END IF
END WHILE
liked Script FTP? Try our other product Email Parser
Thanks.
Your script helps but I really need that file size checker to do what I need to do. You have a great program and I look forward to that added function. Then I can reccomend your program to lots of users in my industry.
Thanks again,
Your script helps but I really need that file size checker to do what I need to do. You have a great program and I look forward to that added function. Then I can reccomend your program to lots of users in my industry.
Thanks again,
I have finally added a command to retrieve file sizes: GETFILESIZE
To use it you have to download and install the ScriptFTP development build:
http://www.ScriptFTP.com/ScriptFTP_devel_setup.exe
It is used this way:
The topic in the scripting guide of this command will be added when ScriptFTP 3.2 will be finally released.
To use it you have to download and install the ScriptFTP development build:
http://www.ScriptFTP.com/ScriptFTP_devel_setup.exe
It is used this way:
Code: Select all
You can also use paths along with file names:
# Get the file size (in bytes) of the remote file test1.txt
$result=GETFILESIZE(REMOTE,"test1.txt")
# The size is
PRINT($result)
# Get the file size (in bytes) of the local file test2.txt
$result=GETFILESIZE(LOCAL,"test2.txt")
# The size is
PRINT($result)
Code: Select all
On error this command will return a negative value, on success the size in bytes.# Get the file size (in bytes) of the remote file test.txt
GETFILESIZE(REMOTE,"myremotedir/myremotesubdir/test1.txt")
The topic in the scripting guide of this command will be added when ScriptFTP 3.2 will be finally released.
liked Script FTP? Try our other product Email Parser