下載 puttyhtml
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.htmlmysql
把安裝後的 psftp.exe 放到須要下載文件的目錄sql
嘗試執行遠程鏈接code
運行 psftp.exe htm
open : 111:111:111:111blog
錄入帳號密碼get
help 顯示可執行語句cmd
嘗試下載文件it
編寫test
Download_Start.bat
psftp -l root -pw 7EiwLGiYYX < Download_cmd.txt exit
Download_cmd.txt
open 122.152.212.111 cd /usr/mysql-backup get a.xlsx bye
因爲找不到如何編寫變量,改用sh
建立
download.sh
#!/bin/sh HOST=122.152.212.111 USER=root PASSWORD=7EiwLGiYYX LOCAL_PATH=C:\Users\donald\Desktop\down REMOTE_PATH=/usr/mysql-backup d2=`date +%Y%m%d` FILENAME="zita_wms-"$d2"_013001.dump" psftp -l root -pw 7EiwLGiYYX << EOM open 122.152.212.111 lcd $LOCAL_PATH cd $REMOTE_PATH get $FILENAME bye EOM echo "Success!"