Using WINSCP to transfer data to Linux under Windows

Source: Internet
Author: User
Tags winscp command line

Scenario:
Recently, a project of the company, UI Part I use Python at compile time to do localization, is running under Linux, but development is done under Windows every compile, manually through the WINSCP this tool to the test machine test, It's a lot of trouble. Online check winscp under Windows can also be used directly under the command line, so wrote a bat file compiled after the automatic upload to test and up.
Env:
Remote machine: CentOS (ip:10.64.70.189)
Remote directory:/VAR/TMSO
Compile script: D:\tmso\tool\Compiler.py
Output directory: D:\tmso\build\release
Winscp:d:\program Files (x86) \winscp\winscp.exe
Transfer script: D:\tmso\tool\autoupload.txt

BAT file Contents
echo off
Set psf= "D:\tmso\build\release"
Set compilertooldir= "D:\tmso\tool\"
Set scptool= "D:\Program Files (x86) \winscp\winscp.exe"
Set script= "D:\tmso\tool\autoupload.txt"
D:
CD%compilertooldir%
Python compiler.py
If exist%psf% goto SUCC
If not exist%psf% goto fail
: SUCC
%scptool%/console/script=%script%
Exit
: Fail
echo No Output dir:%psf%
Pause

Autoupload.txt File Contents
Open Root:[email protected]
Synchronize remote D:\tmso\build\release/var/tmso-delete
Exit

==========================================================

WINSCP command Line

WINSCP is an open-source graphical SFTP client that uses SSH in a Windows environment. The SCP protocol is also supported. Its main function is to copy files securely between local and remote computers.

Enter WINSCP directly under CMD to enter the WINSCP operation interface and see the commands that are available to you by entering help directly below.

To connect to a remote machine:
Open [email protected]
Enter the password to log in successfully.

Enter Help:
Winscp> Help
Call executes any remote shell command
CD changes Remote working directory
chmod changing remote file permissions
Close closing Sessions
Exit close all sessions and end the program
Get download files from a remote directory to a local directory
Help Display assistance
Keepuptodate in a remote directory continuously reflects changes in the local directory
LCD changes local working directory
LLS listing the contents of a local directory
ln New remote Symbolic link
LPWD Show Local working directory
LS lists the contents of the remote directory
mkdir New Remote Directory
MV Move or rename remote files
Open Connect to Server
option to set or display the value of a script option
Put upload files from a local directory to a remote directory
PWD Displays remote working directory
RM Delete remote Files
RmDir Deleting a remote directory
Session lists connected sessions or selects active sessions
Synchronize synchronizing a remote directory with a local directory

If you want to see how a particular command is used:
Help command
Cases:
Help Synchronize
winscp> Help Synchronize
Synchronize Local|remote|both [[]]
When the first parameter is ' local ', it is synchronized remotely with a local.
Synchronize the remote directory with a local directory when the first parameter is ' remote '.
When the first parameter is ' both ', synchronize another with one.
Synchronizes the current working directory when the directory is not specified.
If ' Synchdelete ' is set to ' on ', the old file will be deleted.
Note: For this command, the overwrite confirmation is always off.
The affected options:
Transfer, Synchdelete, exclude, include
Example:
Synchronize remote
Synchronize both D:\/home/martin/public_html

Although it is just a file transfer tool, equivalent to a tool like FTP, but this thing is quite powerful, worth knowing! A lot of hackers use this stuff!

WINSCP command line batch read remote server file example article category: Operating system

Option echo off
Option Batch On
Option confirm off
Open Scp://yourusername:[email protected]
GET/OPT/BACKUP/GNOME-LIBS-1.4.2.TAR.BZ2 d:\ui\gnome-libs-1.4.2.tar.bz2
Close
Exit

Methods to synchronize the entire folder synchronize:
Option echo off
Option Batch On
Option confirm off
Open Scp://yourusername:[email protected]
cd/opt/backup/
Option Transfer Binary
Option Synchdelete off
Synchronize local D:\ui
Close
Exit

http://ju.outofmemory.cn/entry/77341

Using WINSCP to transfer data to Linux under Windows

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.