Posted On March 31, 2019

Script to Push Files to Remote SFTP Server

kimconnect 0 comments
blog.KimConnect.com >> Codes >> 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
winscp.com /ini=nul /command ^
"open sftp://USERNAME:[email protected]:2222 -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%
del \\SERVER01\SOMETHING\*.* /Q

Leave a Reply

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

Related Post

PowerShell: Time Stamp Variable

This is useful in almost any script as it enables the accurate timestamp of log…

Python Module: JSON

Overview JavaScript Object Notation (JSON) is written in plain-text that is very useful to store…

How To Add JavaScript Functions into WordPress

Assuming that the 'Code Snippets' plugin has already been installed, here's a demonstration of adding…