FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
xcode_shell/sftpDownloadFile at master · webfrogs/xcode_shell · GitHub
webfrogs
/
xcode_shell
Public
Notifications
You must be signed in to change notification settings
Fork
389
Star
1k
Code
Issues
0
Pull requests
1
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
xcode_shell
/
sftpDownloadFile
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
47 lines (36 loc) · 1.08 KB
Breadcrumbs
xcode_shell
/
sftpDownloadFile
Copy path
File metadata and controls
executable file
·
47 lines (36 loc) · 1.08 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/expect -f
#--------------------------------------------
# 功能:使用sftp到服务器指定目录下载指定文件到当前路径
# 使用说明:命令有5个参数。注意:目前该脚本无参数验证功能,必须5个参数,否则脚本运行结果会发生错误
# 参数1:要下载的文件名
# 参数2:服务器地址
# 参数3:sftp用户名
# 参数4:sftp密码
# 参数5:sftp工作路径
# 作者:ccf
# E-mail:ccf.developer@gmail.com
# 创建日期:2013/02/27
#--------------------------------------------
#参数设置
set downloadFileName [lindex $argv 0]
set host [lindex $argv 1]
set username [lindex $argv 2]
set password [lindex $argv 3]
set hostfilepath [lindex $argv 4]
#sftp连接
spawn sftp $username@$host
#第一次sftp时需输入yes
expect {
"(yes/no)?" {send "yes\r"; exp_continue}
"password:" {send "$password\r"}
}
#切换到所要放置的目录下
expect "sftp>"
send "cd $hostfilepath\r"
#从服务器上下载指定
expect "sftp>"
send "get $downloadFileName\r"
#退出sftp
expect "sftp>"
send "bye\r"
expect eof
Back
|
FazBrowse Home
|
New Git URL