我尝试递归下载远程文件夹(CD 光盘安装到此文件夹)但失败,可能是由于非 ASCII 文件名:
> sftp mati@mati
mati@192.168.1.3's password:
Connected to mati@mati.
sftp> cd "/run/media/mati/Marcin Zielinski/"
sftp> ls -l
dr-x------ 1 mati mati 2048 Aug 23 2017 K1 - BÓG NIE DAJE TANDETY, ALE TO, CO NAJLEPSZE
(...)
sftp> get -r "K1 - BÓG NIE DAJE TANDETY, ALE TO, CO NAJLEPSZE"
Fetching /run/media/mati/Marcin Zielinski/K1 - BÓG NIE DAJE TANDETY, ALE TO, CO NAJLEPSZE/ to K1 - BÓG NIE DAJE TANDETY, ALE TO, CO NAJLEPSZE
Retrieving /run/media/mati/Marcin Zielinski/K1 - BÓG NIE DAJE TANDETY, ALE TO, CO NAJLEPSZE
Couldn't open local file "K1 - B\303\223G NIE DAJE TANDETY, ALE TO, CO NAJLEPSZE/1 - K1-B\303\263g nie daje tandety, ale to co najlepsze.mp3" for writing: Permission denied
Download of file /run/media/mati/Marcin Zielinski/K1 - B\303\223G NIE DAJE TANDETY, ALE TO, CO NAJLEPSZE/1 - K1-B\303\263g nie daje tandety, ale to co najlepsze.mp3 to K1 - B\303\223G NIE DAJE TANDETY, ALE TO, CO NAJLEPSZE/1 - K1-B\303\263g nie daje tandety, ale to co najlepsze.mp3 failed
(...)
我看到非ascii字母被翻译,例如错误消息中的Ó
是\303\223
,这可能就是它失败的原因(更新:这不是原因)。 如何使用 sftp 递归下载整个文件夹?
当我使用 folder/*
表示法下载文件时,一切正常(文件名未翻译):
sftp> get -r "K1 - BÓG NIE DAJE TANDETY, ALE TO, CO NAJLEPSZE"/*
Fetching /run/media/mati/Marcin Zielinski/K1 - BÓG NIE DAJE TANDETY, ALE TO, CO NAJLEPSZE/1 - K1-Bóg nie daje tandety, ale to co najlepsze.mp3 to 1 - K1-Bóg nie daje tandety, ale to co najlepsze.mp3
/run/media/mati/Marcin Zielinski/K1 - BÓG NIE DAJE TANDETY, ALE TO, CO NAJLEPSZE/1 - K1-Bóg nie daje tandety, ale to co najlepsze.mp3 100% 2395KB 97.7MB/s 00:00
Fetching /run/media/mati/Marcin Zielinski/K1 - BÓG NIE DAJE TANDETY, ALE TO, CO NAJLEPSZE/2 - K1-Bóg nie daje tandety, ale to co najlepsze.mp3 to 2 - K1-Bóg nie daje tandety, ale to co najlepsze.mp3
/run/media/mati/Marcin Zielinski/K1 - BÓG NIE DAJE TANDETY, ALE TO, CO NAJLEPSZE/2 - K1-Bóg nie daje tandety, ale to co najlepsze.mp3 100% 4585KB 107.6MB/s 00:00
(...)
本地和远程主机都运行 Manjaro x64。
最佳答案
sftp客户端和sftp服务器都需要配置UTF8编码。
完成后,它应该可以正常工作。
关于linux - 从安装的 CD 光盘递归下载文件的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52188650/