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?
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
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:
Code: Select allWHILE("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
A new command to get file sizes will be added soon.
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,
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:
Code: Select all# 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)  
You can also use paths along with file names:
Code: Select all# Get the file size (in bytes) of the remote file test.txt GETFILESIZE(REMOTE,"myremotedir/myremotesubdir/test1.txt")  
On error this command will return a negative value, on success the size in bytes.

The topic in the scripting guide of this command will be added when ScriptFTP 3.2 will be finally released.