Wiki

Scale Your Enterprise

User Tools

Site Tools


bw:ftp_and_bizweaver

This is an old revision of the document!


FTP and Bizweaver

By design, Bizweaver does not include its own FTP functionality. Instead it uses the WF_Exec tool to call any FTP application that supports a command-line interface. The most common application used by Third Wave is winSCP (https://winSCP.net). We have found that winSCP offers all the functionality that is typically required. This page describes how to use winSCP with Bizweaver.

Basic Process

winSCP is initiated from Bizweaver using the WF_Exec tool. This tool calls a Windows batch (.bat) file. The batch file then calls a text file (.txt) that contains the information needed to execute winSCP. Sample scripts are provided below. The scripts can be downloaded or copied and pasted into a local file.

Sample Batch File

The batch file serves two purposes. First, it initiates the winSCP application and indicates which command file is to be used. This is the second line in the sample that follows. Second, it writes information to a log file. The log file captures the start and end times of each run, as well as the details returned from winSCP about the FTP process. This information can be very helpful when troubleshooting transfer issues.

Note that the various files are placed in a folder named “FTP Controls” in the main Bizweaver folder “C:\ProgramData\Bizweaver”. Any folders accessible by Bizweaver can be used for this purpose. Just update the path names in the script. Keep in mind that if you use the path noted in the sample you will need to create the “FTP Controls” folder.

winSCP_Main.bat
 echo Starting FTP transfer at %date% : %time% >> "C:\ProgramData\Bizweaver\FTP Controls\FTPLog.txt"
"C:\Program Files (x86)\WinSCP\winscp.com" /script="C:\ProgramData\Bizweaver\FTP Controls\WinSCP_Command.txt" >> "C:\ProgramData\Bizweaver\FTP Controls\FTPLog.txt"
echo Ending FTP transfer at %date% : %time% >> "C:\ProgramData\Bizweaver\FTP Controls\FTPLog.txt" 

Sample Command File

The “command” file is simply a text file with information used by winSCP during execution. There are many options available. The sample file provided below contains the basic information needed for an FTP transfer. Lines that begin with # are comments. Lines with ## are the actual command. Remove the ## to include the command.

winSCP_Command.txt
# Automatically abort script on errors
## option batch abort
# Disable overwrite confirmations that conflict with the previous
## option confirm off
# Connect
# ssh-rsa 2048 6e:2d:96:c3:df:0a:ed:4a:7e:bd:b3:82:e9:4e:9d:22
# The following establishes a connection using an ssh-rsa key
# "hostname" is specific to the FTP server where the connection is being made.
## open username:password@hostname.com -hostkey="ssh-rsa 2048 6e:2d:96:c3:df:0a:ed:4a:7e:bd:b3:82:e9:4e:9d:22"
#
# The following establishes a basic SFTP connection 
## open sftp://username:password@hostname.com/
#
# List remote folder
## ls
#
# Change the current working remote folder
## cd /home/user
#
# Force binary mode transfer
## option transfer binary
#
# Download file to a local folder
# This example also uses the "-delete" option to delete the file on the remote server once is has been downloaded.
# The option does not necessarily need to be used.
# The target folder may need to be changed
## get -delete *.csv C:\ProgramData\Bizweaver\FTP_In
#
# Upload the file to current working remote folder
## put examplefile.txt
#
# Disconnect from the remote server
## close
# Exit WinSCP
## exit 

Complete information about command-line options can be found here https://winscp.net/eng/docs/commandline.

You can also use the winSCP application to generate the command file for you. Information on the this process is found here https://winscp.net/eng/docs/ui_generateurl. Copy the script that is created using this process and paste it into your “command” file.

bw/ftp_and_bizweaver.1547828605.txt.gz · Last modified: 2019/01/18 11:23 by runger