我想将一堆文件从我的盒子上传到我的 FTP 服务器。如果我发送完整的文件名,则没有问题,但似乎 ftp 命令无法发送带有文件名通配符的文件。以下是我所做的:
$ ftp 192.168.1.1
Connected to 192.168.1.1.
220 Welcome to ASUS DSL-N14U FTP service.
Name (192.168.1.1:osmc): admin
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> !ls \[KaMi\]_\(Hi10\)_Bleach_-_26*
[KaMi]_(Hi10)_Bleach_-_260_(720p)_(ELEMENT).mkv
[KaMi]_(Hi10)_Bleach_-_261_(720p)_(BlazerSoul).mkv
[KaMi]_(Hi10)_Bleach_-_262_(720p)_(BlazerSoul).mkv
[KaMi]_(Hi10)_Bleach_-_263_(720p)_(BlazerSoul).mkv
[KaMi]_(Hi10)_Bleach_-_264_(720p)_(ELEMENT).mkv
[KaMi]_(Hi10)_Bleach_-_265_(720p)_(ELEMENT).mkv
[KaMi]_(Hi10)_Bleach_-_266_(720p)_(ELEMENT).mkv
[KaMi]_(Hi10)_Bleach_-_267_(720p)_(Flomp).mkv
[KaMi]_(Hi10)_Bleach_-_268_(720p)_(Flomp).mkv
[KaMi]_(Hi10)_Bleach_-_269_(720p)_(Flomp).mkv
ftp> mput \[KaMi\]_\(Hi10\)_Bleach_-_26*
mput [KaMi]_(Hi10)_Bleach_-_26*? y
local: [KaMi]_(Hi10)_Bleach_-_26*: No such file or directory
ftp>
编辑:似乎主要问题在于文件名中的特殊字符,例如 [、]、( 和 )。因为重命名它们后,一切正常:
$ for ((i=0;i<6;i++)); do mv \[KaMi\]_\(Hi10\)_Bleach_-_26$i* Bleach.26$i.S13E$((31+i)).mkv; done
$ ftp 192.168.1.1Connected to 192.168.1.1.
220 Welcome to ASUS DSL-N14U FTP service.
Name (192.168.1.1:osmc): admin
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> prompt
ftp> !ls Bleach.26*
Bleach.260.S13E31.mkv Bleach.262.S13E33.mkv Bleach.264.S13E35.mkv
Bleach.261.S13E32.mkv Bleach.263.S13E34.mkv Bleach.265.S13E36.mkv
ftp> mput Bleach.26*
local: Bleach.260.S13E31.mkv remote: Bleach.260.S13E31.mkv
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 File receive OK.
157916406 bytes sent in 14.56 secs (10.3431 MB/s)
local: Bleach.261.S13E32.mkv remote: Bleach.261.S13E32.mkv
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 File receive OK.
115469065 bytes sent in 10.76 secs (10.2387 MB/s)
local: Bleach.262.S13E33.mkv remote: Bleach.262.S13E33.mkv
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 File receive OK.
112886089 bytes sent in 11.04 secs (9.7521 MB/s)
local: Bleach.263.S13E34.mkv remote: Bleach.263.S13E34.mkv
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 File receive OK.
156384088 bytes sent in 14.50 secs (10.2820 MB/s)
local: Bleach.264.S13E35.mkv remote: Bleach.264.S13E35.mkv
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 File receive OK.
148707976 bytes sent in 14.04 secs (10.0982 MB/s)
local: Bleach.265.S13E36.mkv remote: Bleach.265.S13E36.mkv
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 File receive OK.
161106339 bytes sent in 15.06 secs (10.2043 MB/s)
ftp>
但我很好奇如何在不重命名的情况下做到这一点。