Our Products:
CompleteFTP
edtFTPnet/Free
edtFTPnet/PRO
edtFTPj/Free
edtFTPj/PRO
Login
Remember
Google Login
Register
All Activity
Questions
Hot!
Unanswered
Tags
Categories
Ask a Question
Ask a Question
How do I download the last 4K of a very large file?
0
votes
5.6k
views
asked
Jan 11, 2011
in
.NET FTP
by
andyr
(
280
points)
hi,
I want to download the last 4K of a very large file into a byte array. I don't have the rest of the file locally.
Can this be done with the free library please?
Thanks.
Please
log in
or
register
to add a comment.
Please
log in
or
register
to answer this question.
8
Answers
0
votes
answered
Jan 11, 2011
by
support2
(
162k
points)
Yes, you can do this via the FTP REST command. If you know the size of the file, subtract 4k from it to get x bytes.
Then do this:
ftp.InvokeFTPCommand("REST x")
ftp.DownloadByteArray(...)
I haven't actually tried this but I *think* it will work.
Please
log in
or
register
to add a comment.
0
votes
answered
Jan 11, 2011
by
andyr
(
280
points)
Hi Bruce,
I had tried that. For an 18 byte file called test.txt I did:
ftp.InvokeFTPCommand("REST 14", "350");
var bytes = ftp.DownloadByteArray("test.txt");
but this downloads all 18 bytes and not the last 4 as required.
Any thoughts please?
Please
log in
or
register
to add a comment.
0
votes
answered
Jan 11, 2011
by
andyr
(
280
points)
Also, this is whats coming back from the ftp server after the REST command in the LastValidReply of the FTPConnection:
REST supported. Restarting at 14
Please
log in
or
register
to add a comment.
0
votes
answered
Jan 12, 2011
by
support2
(
162k
points)
Please post the debug log here.
Please
log in
or
register
to add a comment.
0
votes
answered
Jan 12, 2011
by
andyr
(
280
points)
Not sure how to get the logs but I will check. Meanwhile if you repro it with an 18 byte text file and :
For an 18 byte file called test.txt I did:
ftp.InvokeFTPCommand("REST 14", "350");
var bytes = ftp.DownloadByteArray("test.txt");
but this downloads all 18 bytes and not the last 4 as required.
You will see it fail.
Please
log in
or
register
to add a comment.
0
votes
answered
Jan 12, 2011
by
support2
(
162k
points)
Take a look in the dev guide for the logging how to.
Please
log in
or
register
to add a comment.
0
votes
answered
Jan 12, 2011
by
andyr
(
280
points)
Hi,
I've confirmed its a bug in your downloadbytearray code with reflector. You always start at the beginning of the stream.
I don't have time to submit the debug logs when you've already got good repro steps and I can see from the code that it won't work.
I've had to move to a different FTP library thats supports downloading part of a file. Good luck in fixing the bug.
Please
log in
or
register
to add a comment.
0
votes
answered
Jan 13, 2011
by
support2
(
162k
points)
Ok thanks for the info. We never really thought people would use resume with a byte array!
Please
log in
or
register
to add a comment.
Categories
All categories
Products
(2.8k)
CompleteFTP
(418)
Java FTP
(1k)
.NET FTP
(1.4k)
FAQ
(120)
General
(178)
Feature Requests
(21)
...