| Both sides previous revision
Previous revision
Next revision
|
Previous revision
|
bw:ftp_and_bizweaver [2019/01/18 11:14] runger [Basic Process] |
bw:ftp_and_bizweaver [2022/04/22 10:30] (current) akoehler [Sample Command 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. | 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 begin with # are comments. Lines with ## are the actual command. Remove the ## to include the command. | 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 option does not necessarily need to be used. | # 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 |
| # Exit WinSCP | # Exit WinSCP |
| ## exit </file> | ## exit </file> |
| | |
| | Complete information about command-line options can be found here https://winscp.net/eng/docs/commandline. |
| | |
| | |