Archives
- July 2019
- January 2019
- November 2018
- August 2018
- July 2018
- February 2018
- November 2017
- October 2017
- July 2017
- June 2017
- May 2017
- April 2017
- January 2017
- December 2016
- November 2016
- August 2016
- January 2015
- December 2014
- March 2014
- April 2013
- December 2010
- November 2009
- September 2009
- June 2009
- March 2009
- February 2009
- November 2008
- October 2008
- August 2008
- July 2008
- January 2008
How to download the files created in the last 48 hours
Date and time operations in ScriptFTP are something that we often get asked in the tech support email. ScriptFTP stores time ranges in seconds and this is sometimes counter-intuitive if you want to do date and time operations like checking how old a file is. Fortunately, this type-free approach in the ScriptFTP language also makes the syntax easier to understand.
Well, let’s go to the actual topic of this blog post: How you can check if a file in the FTP site was created in the last 48 hours and if so download it. Here is the script. The comments in it are very self-explanative:
Network drive not available when the FTP script is scheduled
As all Windows applications, ScriptFTP supports the use of UNC paths and network drives. You can use the files and folders stored in them as if they were located in hard drive of the machine where ScriptFTP is running. For instance:
# Upload to the FTP server all the Excel files stored in the mapped network drive Z PUTFILE("Z:\the_folder\*.xlsx") # Upload to the FTP server all the Word documents stored in a network share called Reports # under the computer named ACCOUNTING-PC-1 PUTFILE("\\ACCOUNTING-PC-1\Reports\*.docx")
How to set a FTP script to be run every X minutes
From time to time a question like this is received in the tech support inbox:
I wanted to ask if you can set the sheduler every minute, thank you so much
A dump of random common questions
I would like to obtain the encryption tool.
It is needed to buy a license in order to get the script enryption tool. You can find more information here.
Once you hace purchased the license please ask for a link to the tool at support@scriptftp.com
How can i start a scheduled task every hour at XX:55 and at startup of scriptFTP
You need to create a scheduled task within ScriptFTP and then open the windows task scheduler (usually under the control panel). Once you have located that task in the windows scheduler, open it and go to the “Triggers” tab. There you have to schedule the task to be run daily at, for instance, 00:55 and to be repeated every hour for one day.
To run a script file at the ScriptFTP startup you need to create a shortcut in windows that calls ScriptFTP wiith these parameters:
C:\Program Files(x86)\ScriptFTP\ScriptFTP.exe "C:\the_path\to_my_script\the_script_file.ftp"
Handling file dates and time spans
The ScriptFTP scripting language does not have data types (as most scripting languages) and dealing with anything which is not plain text requires some kind of tricks. This happens with file lists as we have seen before, dates and time spans suffer the same limitation. This post covers how these data types are handled in ScriptFTP.
How to run a scheduled FTP script in the background
The ScriptFTP integrated scheduler is used to set a script to be run at given times. Once a script is scheduled the Windows Task programming service will automatically launch ScriptFTP.exe with the appropiate parameters and a window will pop-up in the user desktop and do the file transfer. Some users find this annoying and want the FTP script to be run in the background. This post covers this issue.
A note about the script to EXE conversion service
From time to time we receive an email asking if the script to EXE conversion service (more info about it here) is an installable software, or a Windows service that runs in the background and automatically converts the FTP files to standalone EXE programs.
Well, it is not. This is a special kind of customer service where we manually build an EXE file (using the Windows development tools) from a script file you send to us. It is that simple ;).
A question regarding how to share parameters between many script files
I would like to share here a common question that from time to time it is answered via email (you can request tech support in the Contact section):
Dear Support:
Sorry to bother you, I looked at a few forum pages and could not search for ‘include’ (because it was ‘a too common word’). Just a high-level question in three parts as I am evaluating ScriptFTP:
1) Can I use the equivalent of an ‘#include <stdio.h>’ (C notation) to put common parts of scripts or functions into one place? All the examples I have seen were in one stand-alone ‘.ftp’ file.
2) If not possible, can I at least make a connection script that I call from another script and use it?
(For example on.ftp is the logon and off.ftp the logoff script, can I have a main.ftp that calls on.ftp, does some FTP stuff and calls off.ftp then?)
3) If 2) works, could I call the three .ftp scripts from a Powershell individually (in sequence)? Or do I lose the connection as soon as the script is done?So far I am impressed. The scripting is easy and straightforward, and from what I’ve read I can combine it with Powershell via command line… The best feature is the return code check after each command during the session. Good job.
And our answer here:
1) “Including” other script files within a script is not supported, sorry.
2) If you want to share server names, user names etc among many scripts try using GETENV (to retrieve an environment variable where you have stored the FTP server address, for example) or use GETPARAM which retrieves parameters from the command line. I hope this answer your question.
3) The connection is lost but you can call three script sequentially just call ScriptFTP.exe the_script_path.ftp. See ScriptFTP in the command line