Transfer behavior

Inspect size, time, and resume support

Use SIZE, MDTM, and REST carefully to inspect and resume transfers when the server advertises them.

8 minute lesson

~~~

SIZE can report a file size. MDTM can report its last modification time in UTC. REST STREAM allows a later transfer to restart at a byte marker when supported.

These are extensions, so discover them with FEAT. Modification time is useful metadata, but it is not a content checksum.

Before resuming, confirm the remote object and local partial file still refer to the same content. Resuming the wrong version creates a quietly corrupted result.

A resumed download can look like this:

C: TYPE I
S: 200 Type set to I
C: SIZE archive.tar.gz
S: 213 104857600
C: REST 52428800
S: 350 Restarting at 52428800
C: RETR archive.tar.gz

The client appends bytes starting at the marker to a 52,428,800-byte local partial file. A mismatch between the marker and local length corrupts the output.

MDTM timestamps use UTC in the standardized form. They help detect a changed object but remain weaker than a content digest. FTP has no universally deployed standard command that guarantees a cryptographic hash.

Resume support can differ by command and transfer type. Discover features, use TYPE I, and test the exact server. If identity cannot be established, restart from zero.

Create a partial test file, resume it, and compare the final cryptographic hash with a known-good copy. Then change the remote file and show how size-only validation can miss the wrong content.

Lesson completed

Take this course offline

Get every free book and course as PDF and EPUB files.

Get the download library →