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 Script to Read/Parse XML Files in a Directory

# This script is to be set on the FTP server or $folder = '\\FTPSERVER05\SFTP\EDI\INCOMING';$files…

Repair VSS in Windows 2008

net stop “System Event Notification Service”net stop “Background Intelligent Transfer Service”net stop “COM+ Event System”net…

PowerShell: Export Event Logs by a Certain Date Range

# User defined variables $daysLimit=7 $startdate=(get-date).adddays(-$daysLimit) $computername=$env:computername $logName='Application' $filterTypes='Error','Warning' $logPath="c:\temp\eventlogs-from-$($startdate.tostring('yyyy-MM-dd'))-to-$((get-date).tostring('yyyy-MM-dd')).csv" # Get the event logs…