Commands and files

Download, upload, and change files

Recognize the core commands for retrieving, storing, appending, renaming, and deleting remote files.

8 minute lesson

~~~

RETR path downloads a file. STOR path uploads or replaces one. APPE path appends data when supported.

DELE removes a file. Renaming is a two-command sequence: RNFR old-name selects the source, then RNTO new-name supplies the destination.

The server replies on the control connection while file bytes use the data connection. Wait for the final completion reply before treating the operation as successful.

An upload should use a temporary remote name:

C: STOR release.zip.part
S: 150 Opening data connection
...bytes...
S: 226 Transfer complete
C: RNFR release.zip.part
S: 350 Ready for destination name
C: RNTO release.zip
S: 250 Rename successful

The 226 proves the transfer command completed. The later 250 proves the rename completed. Keep those as two separate facts.

STOR can replace an existing object depending on server policy. Do not assume a failed upload preserved the old file unless you tested the server behavior. APPE is especially dangerous when a retry repeats bytes.

Before destructive commands such as DELE, capture the exact remote path and account. Avoid building commands from untrusted filenames without validation.

Run this workflow against disposable files. Interrupt one upload before 226 and confirm that the public filename never exposes the partial content.

Lesson completed

Take this course offline

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

Get the download library →