網頁

2020年4月27日 星期一

sftp lftp

伺服器端可以安裝簡易版的 Rebex Tiny SFTP Server


客戶端
若是 win7 需要
安裝 Microsoft .NET Framework 4
安裝 Microsoft .NET Framework 4.5
安裝 PowerShell 3.0
使用 administrator 開啟 powershell
install Chocolatey 它就像是 windows 版的 apt-get
再安裝 lftp
PS C;\> Get-ExecutionPolicy
PS C;\> Set-ExecutionPolicy AllSigned
PS C;\> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
PS C;\> choco install lftp


man lftp

download
lftp -c "set sftp:auto-confirm yes; open -u username,passowrd -p port sftp://ip; mirror -e -p remote_path local_path; quit"

upload
lftp -c "set sftp:auto-confirm yes; open -u username,passowrd -p port sftp://ip; mirror -e -p -R local_path remote_path; quit"

mkdir
lftp -c "set sftp:auto-confirm yes; open -u username,password -p port sftp://ip; mkdir -p /pathA/pathB; quit"

cd, lcd, mput
lftp -c "set sftp:auto-confirm yes; open -u username,password -p port sftp://ip; lcd /localPath; cd /remotePath; mput *; quit"

mirror with Regular Expression
lftp -c "set sftp:auto-confirm yes; open -u username,password -p port sftp://ip; mirror -x 'jpg$' -R /localPath /remotePath; quit"
lftp -c "set sftp:auto-confirm yes; open -u username,password -p port sftp://ip; mirror -i 'ini$|sign$' -R /localPath /remotePath; quit"


windows path to unix path
d:\path
/cygdrive/d/path


沒有留言:

張貼留言