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: Hyper-V Management

Migrate Live Virtual Machines (In Clustered Environment): # Connect to Hyper-V Host$remoteHost="HYPERV01"Enter-PsSession $remoteHost # Move…

Basic CSS: Specify How Fonts Should Degrade

<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css"><style>.red-text {color: red;}h2 {font-family: Lobster;}p {font-size: 16px;font-family: monospace;}</style><h2 class="red-text">CatPhotoApp</h2><main><p class="red-text">Click here to…

PowerShell: How to Replace a System File – For Experimentation Purposes

# When attempting to rename a system protected file such as notepad.exe $notepadExe='C:\Windows\system32\notepad.exe' $newNotePadExe='C:\Users\rambo\Desktop\notepad.exe' rename-item…