我正在开发一个工具来获取一些数据,这些数据隐藏在远程系统上的一个非常大的文件中。复制整个文件是不切实际的,我需要的所有数据都在文件的前1000个字节内。我知道我可以启动一个get,然后用^C取消它以获得一个部分文件,但是这将很难(如果不是不可能的话)用任何一致性自动完成。
我想告诉我的ftp客户端只抓取远程文件的x字节,一旦有了它们就退出。我在ftp手册页面中找到了一些做部分下载的windows客户端,但是我没有在ftp手册页面中找到任何东西,而且在线文档也很稀少。
我发现了一个HowTo:http://cdsarc.u-strasbg.fr/doc/ftp.htx,它建议使用以下语法:
ftp> get bigfile.dat:0-5000 bigfile.nxt我不清楚这是否应该在客户机或服务器中实现,但在这两种情况下,它似乎都不适用于我的环境。(标准linux ftp客户端连接到z/OS上运行的FTP服务器)
即使在linux标准ftp客户端和windows上的filezilla服务器之间尝试时,我的尝试仍以以下方式失败
ftp> get green.gif:0-10c
local: green.gif:0-10c remote: green.gif:0-10c
227 Entering Passive Mode (9,42,91,226,4,105)
550 File not found因此:0-10 c被解释为文件名的一部分。失败。有什么想法吗?
发布于 2009-06-03 15:29:18
用卷发。从手册页:
-r/--range <range>
(HTTP/FTP/FILE) Retrieve a byte range (i.e a partial document)
from a HTTP/1.1, FTP server or a local FILE. Ranges can be spec-
ified in a number of ways.
0-499 specifies the first 500 bytes
500-999 specifies the second 500 bytes
-500 specifies the last 500 bytes
9500- specifies the bytes from offset 9500 and forward
0-0,-1 specifies the first and last byte only(*)(H)
500-700,600-799
specifies 300 bytes from offset 500(H)但是,请注意,服务器必须支持大小扩展才能使其工作。
发布于 2009-06-03 15:29:19
我想你想用卷发来做这个
从手册页:
-r/--range <range>
(HTTP/FTP/FILE) Retrieve a byte range (i.e a partial document)
from a HTTP/1.1, FTP server or a local FILE. Ranges can be spec‐
ified in a number of ways.
0-499 specifies the first 500 bytes
500-999 specifies the second 500 bytes
-500 specifies the last 500 bytes
9500- specifies the bytes from offset 9500 and forward发布于 2009-06-03 15:31:24
这样的方案在很大程度上取决于服务器的实现。有些服务器比其他服务器支持更多的特性。
我会研究一些分割文件的方法,或者考虑一个自定义应用程序,它将发送您所要求的范围。
https://serverfault.com/questions/18834
复制相似问题