Script to Push Files to Remote SFTP Server

# 1. Install WINSCP and include it in the %PATH% environmental variables
# 2. Run this script via Task Scheduler (run every minute)

echo off
option batch on
option confirm off /ini=nul /command ^
"open s -hostkey=""ssh-rsa 2048 xx:xx:03:6b:4f:09:4b:95:dc:0d:f1:xx:xx:xx:xx""" "lcd \\SERVER01\SOMETHING" "cd /REMOTE/DIRECTORY" "put -nopermissions -nopreservetime ""*.*""" "exit"
if %errorlevel% neq 0 exit /b %errorlevel%

Leave a Reply

Your email address will not be published. Required fields are marked *