Wiki

Scale Your Enterprise

User Tools

Site Tools


bw:ftp_and_bizweaver

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
bw:ftp_and_bizweaver [2019/01/18 11:06]
runger created
bw:ftp_and_bizweaver [2022/04/22 10:30] (current)
akoehler [Sample Command File]
Line 3: Line 3:
  
 ==== Basic Process ==== ==== 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.+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 ==== ==== Sample Batch File ====
-The batch file serves two purposes.  First, it initiates the winSCP application and indicates which command file 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.+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.+Note that the various files are placed in a folder named "FTPControls" 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 "FTPControls" folder.
  
 <file bat winSCP_Main.bat> echo Starting FTP transfer at %date% : %time% >> "C:\ProgramData\Bizweaver\FTP Controls\FTPLog.txt" <file bat 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+"C:\Program Files (x86)\WinSCP\winscp.com" /script="C:\ProgramData\Bizweaver\FTPControls\WinSCP_Command.txt" /log="C:\ProgramData\Bizweaver\FTPControls\winscp.log" /loglevel=0 /logsize=5*5M
-echo Ending FTP transfer at %date% : %time% >> "C:\ProgramData\Bizweaver\FTP Controls\FTPLog.txt" </file>+echo Ending FTP transfer at %date% : %time% >> "C:\ProgramData\Bizweaver\FTPControls\FTPLog.txt" </file
 + 
 +==== Command File ==== 
 +The "command" file is simply a text file with information used by winSCP during execution.  A sample file is provided below to show how the main options are defined. 
 + 
 +<WRAP center round tip> 
 +You can 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 save it as your "command" file.  Be sure to save the file with the name defined in the batch file. 
 +</WRAP>
  
 ==== Sample Command File ==== ==== 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 beging with # are comments.+The sample file provided below a command file.  Lines that begin with # are comments.  Lines with ## are the actual command.  If you chose to use this file as a starting point, remove the ## to include the command. 
 <file bat winSCP_Command.txt># Automatically abort script on errors <file bat winSCP_Command.txt># Automatically abort script on errors
-# option batch abort+## option batch abort
 # Disable overwrite confirmations that conflict with the previous # Disable overwrite confirmations that conflict with the previous
-# option confirm off+## option confirm off
 # Connect # Connect
 # ssh-rsa 2048 6e:2d:96:c3:df:0a:ed:4a:7e:bd:b3:82:e9:4e:9d:22 # 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 # The following establishes a connection using an ssh-rsa key
 # "hostname" is specific to the FTP server where the connection is being made. # "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"+## 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  # The following establishes a basic SFTP connection 
-# open sftp://username:password@hostname.com/+## open sftp://username:password@hostname.com/
 # #
 # List remote folder # List remote folder
-# ls+## ls
 # #
 # Change the current working remote folder # Change the current working remote folder
-# cd /home/user+## cd /home/user
 # #
 # Force binary mode transfer # Force binary mode transfer
-# option transfer binary+## option transfer binary
 # #
 # Download file to a local folder # Download file to a local folder
-# This example also deletes the file on the remote server once is have been downloaded.  The -delete is an option that does not necessarily need to be used.+# 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 # The target folder may need to be changed
-get -delete *.csv C:\ProgramData\Bizweaver\FTP_In+## get -delete *.csv C:\ProgramData\Bizweaver\FTP_In\
 # #
 # Upload the file to current working remote folder # Upload the file to current working remote folder
-# put examplefile.txt+## put examplefile.txt
 # #
-# Disconnect +# Disconnect from the remote server 
-close+## close
 # Exit WinSCP # Exit WinSCP
-exit </file>+## exit </file> 
 + 
 +Complete information about command-line options can be found here https://winscp.net/eng/docs/commandline. 
 + 
bw/ftp_and_bizweaver.1547827613.txt.gz · Last modified: 2019/01/18 11:06 by runger