Background: Use WINSCP to upload files, upload from Windows to Linux, avoid the hassle of using software, so use script form
Note: Commands need to be executed on one line, variable settings can be divided into multiple lines
---------------------------------------------------Split Line----------------------------------------------------------
:: Setting parameters
:: WINSCP Installation path
SET ROOTPATH=C:\KIT\WINSCP
:: Sftp Path
SET Sftppath=sftp://user:[email protected]:p ORT
:: Local file path (Windows)
SET localfilepath=c:\users\island\desktop\upload\
:: Destination file path (Linux)
SET Targetfilepath=/usr/upload
:: Local Log flag
SET Logpath=/log
:: Local log file name
SET Logfilename=upload_log_file.txt
:: Command parsing
:: Winscp.exe/console/command "option Batch Continue" "option confirm off" "open Sftp://user:[email Protected]:p ort" "opt Ion transfer binary "" Put d:\ need to upload file path/server file directory "exit"/log=log_file.txt
:: Winscp.exe/console/command---command name
:: "option Batch Continue"---default batch
:: "option confirm off"---to turn off prompt information
:: "Open ftp://user:[email protected]:p ORT user"---access username, pwd: User password, IP:IP address, Port: port number Default 22
:: "option transfer binary"---sent using binary format
:: Log=log_file.txt---Log file address
:: "Exit"---run out
CD%rootpath%
Winscp.exe/console/command "option Batch Continue" "option confirm off" "Open%sftppath%" "option transfer binary" "put %localfilepath%%targetfilepath% "Exit"%logpath%=%logfilename%
WINSCP Bulk Upload Script