winscpディフォルトのインストールパス:
"C:\Program Files (x86)\WinSCP\WinSCP.exe"
このパス「C:\Program Files (x86)\WinSCP\」を環境変数に設定すれば、
CMDにより、どこでも直接winscpを起動できます。
SET PATH=%PATH%;C:\Program Files (x86)\WinSCP\
CMDを起動して、WINSCPを入力して、ENTERにより、WINSCPを起動します。
C:\Users\test>winscp
winscp>
winscp>help
call 任意のリモート コマンドを実行
cd リモート ディレクトリの変更
checksum リモート ファイルのチェックサムを計算する
chmod リモート ファイルの権限を変更
close セッションを閉じる
cp リモート ファイルを複製
echo その引数をメッセージとして表示します
exit すべてのセッションを閉じプログラムを終了する
get リモートからローカルにファイルをダウンロード
help ヘルプを表示
keepuptodate ローカル ディレクトリの変更をリモートに反映
lcd ローカル ディレクトリを変更
lls ローカル ディレクトリの内容を表示
ln リモートにシンボリックリンクを作成
lpwd ローカル ディレクトリの表示
ls リモート ディレクトリの内容を表示
mkdir リモート ディレクトリを作成
mv リモート ファイルを削除または名前変更
open サーバに接続
option スクリプトオプションの値を設定/表示
put ローカルからリモートにファイルをアップロード
pwd リモート ディレクトリの表示
rm リモート ファイルを削除
rmdir リモート ディレクトリを削除
session 接続しているセッションの表示またはアクティブなセッションの選択
stat リモート ファイルの属性を表示
synchronize リモートとローカルのディレクトリを同期
初回リモートサーバへ接続には、パスワードが必要です。その後、SESSIONが出来上がり、再接続する場合には、パスワードが不要になります。
例:
winscp>open user:password@hostname/IP
サーバを探索中・・・
サーバに接続しています・・・
認証しています・・・
ユーザ名"eru" を使用中
入力済みパスワードで認証中
認証されました
セッションを開始しています・・・
セッションを開始しました
アクティブ セッション: [1] user@hostname/IP
winscp>ls
drwxr-xr-x 14 user user 4096 Jul 27 18:17:18 2020 .
drwxr-xr-x 3 root root 17 Jul 9 3:37:38 2019 ..
よく利用されるコマンドは:
リモートコマンド: cd, ls, mkdir, mv, rmdir, rm, pwd,
ローカルコマンド:lcd, lls,lpwd
ファイル転送: get, put
winscp> help get
別名alias: recv, mget
補足パラメータswitches:
-delete Delete source remote file(s) after transfer
転送完了後、リモートファイルを削除する
-resume Resume transfer if possible (SFTP and FTP protocols only)
SFTPとFTPモードの場合、転送再開可能
-append Append file to end of target file (SFTP protocol only)
SFTPモードの場合なら、目標ファイルの末尾から追加転送が可能
-preservetime Preserve timestamp
伝送元先ファイルのタイムスタンプを一致させる
-nopreservetime Do not preserve timestamp
伝送元先ファイルのタイムスタンプを一致しない
-speed=<kbps> Limit transfer speed (in KB/s)
伝送速度制限
-transfer=<mode> Transfer mode: binary, ascii, automatic
伝送モード:バイナリ、テキスト、拡張子により自動判定
-filemask=<mask> Sets file mask.
-resumesupport=<state> Configures resume support.
Possible values are 'on', 'off' or threshold
転送再開可否設定。ON可能、OFF負荷、thredhold設定制限値
-neweronly Transfer new and updated files only
新規または更新されたファイルのみ転送
-latest Transfer the latest file only
タイムスタンプを比較し、サーバより最新ファイルのみ転送
effective options:confirm, failonnomatch, reconnecttime
examples:
get index.html
get -delete index.html about.html .\
get index.html about.html d:\www\
get public_html/index.html d:\www\about.*
get *.html *.png d:\www\*.bak
putコマンドはget とほぼ一緒です。
winscp> help put
alias:
send, mput
switches:
-delete Delete source local file(s) after transfer
-resume Resume transfer if possible (SFTP and FTP protocols only)
-append Append file to end of target file (SFTP protocol only)
-preservetime Preserve timestamp
-nopreservetime Do not preserve timestamp
-permissions=<mode> Set permissions
-nopermissions Keep default permissions
-speed=<kbps> Limit transfer speed (in KB/s)
-transfer=<mode> Transfer mode: binary, ascii, automatic
-filemask=<mask> Sets file mask.
-resumesupport=<state> Configures resume support.
Possible values are 'on', 'off' or threshold
-neweronly Transfer new and updated files only
-latest Transfer the latest file only
effective options:
confirm, failonnomatch, reconnecttime
examples:
put index.html
put -delete index.html about.html ./
put -permissions=644 index.html about.html /home/martin/public_html/
put d:\www\index.html about.*
put *.html *.png /home/martin/backup/*.bak
SESSIONを閉じる場合、
winscp> close
セッション 'user@hostname' を閉じました.
セッションなし
SESSIONを再開する場合、
winscp> open user@hostname
サーバを探索中・・・
サーバに接続しています・・・
認証しています・・・
ユーザ名"user" を使用中
入力済みパスワードで認証中
認証されました
セッションを開始しています・・・
セッションを開始しました
アクティブ セッション: [1] user@hostname
winscpを閉じる場合
winscp> exit
C:\Users\user>
=====================================
おまけに、scpのコマンドで簡単なファイル転送なら
scp [オプション] コピー元パス 保存先パス
例:
# get file from remote serverscp user@hostnameOrIP: ~/test.txt ./
# put file to pwd of remote server
scp user@hostnameOrIP: ./test.txt
没有评论:
发表评论