mTCP FTP client for DOS logo

mTCP FTP is an open source FTP client for DOS that is designed to run well on just about any machine that runs DOS. That includes everything from a PCjr running DOS 2.1 to the latest virtual machines running whatever version of DOS you have installed. Features include:

Here is a screen shot of the FTP client running under DOSBox:

mTCP FTP client screen shot

Signing onto using the mTCP FTP client.

Why use an FTP client for DOS?


Basically, if you have any old PC running DOS with something that looks like a network connection you should be able to run the FTP client.


The mTCP FTP client is included with the other mTCP based applications. They can be downloaded from the main mTCP page here.

Setup instructions

FTP uses the mTCP TCP/IP library for DOS. To use FTP you need a working network connection and an IP address for your DOS machine. Instructions for getting an IP address can be found in the mTCP setup instructions. Setup is not difficult and once it is done it is good for all of the mTCP applications.


FTP uses the following syntax:

ftp [-port <n>] <ftp_server_addr>

Options are:

-help      Show basic help text
-port <n>      Connect using port <n> instead of the default port (21)

You have to specify the FTP server address on the command line. After the control socket is opened you will be prompted for a user ID and password. After that you get a command line just like on other FTP command line clients.

Here are some of the commands:

dir      directory list (full details)
ls      directory list (names only)
pager      Pause ls or dir output after approximately n lines
cd      change to a directory
cdup      move up one directory
pwd      print current working directory
lcd      local change directory
lmd      local make directory
ascii      Set transfer type to 'ASCII'
image      Set transfer type to 'image' or 'binary'
get      Get a file
put      Send a file
mget      get multiple files
mput      put multiple files
prompt      Toggle mget/mput prompting on or off
xfermode      Set default transfer mode - see section below
delete      Delete a file
mkdir      Make directory
rmdir      Remove directory
rename      rename a file on the server
quote      Send a command to the FTP server directly
quit      Quit
shell      Shell to DOS
interactive      Switch from script file to keyboard input

The program captures Ctrl-Break and Ctrl-C. If you use Ctrl-Break during a file transfer or directory listing the current operation will stop (prematurely) and you will be returned to the command line after a brief delay. If you use Ctrl-Break or Ctrl-C at the command line the program will end. (This might take up to 20 seconds depending on the state of the sockets, so please be patient.)

The shell command should be used with care. With the shell command you can do local directory listings, rename local files, look inside of files, and do most normal things. Keep in mind that while you are at the DOS command prompt the mTCP code is not servicing the socket connection - if you stay in DOS too long you might lose your connection to the FTP server.

Transfer modes

The xfermode command requires a little explanation.

In the beginning of time FTP servers always sent data by doing a connect to the FTP client, which was listening for the incoming connection on a default port. The FTP server in NCSA telnet does this. I will call this 'Classic' mode and you can tell this FTP client to handle data transfers this way.

'Classic' mode is only useful for ancient FTP servers that can't do anything else. Most modern FTP servers will not connect to an FTP client on the default ports and most firewalls/routers wouldn't allow it anyway.

'Port' mode is the current default for many clients. Instead of having the FTP server connect to the client on default ports, the client will tell the FTP server exactly what port it should use for the connection. This is slightly better than Classic mode, and should be usable on more FTP servers, firewalls and routers.

'Passive' mode is probably the best and most compatible mode to use with modern FTP servers. It turns things around by making the client connect to the FTP server to make data connections instead of having the FTP server connect to the client. (From the standpoint of the FTP server it is 'passive' and it waits for a connection from the client.) This will work with almost any firewall and router. This is the mode I'd recommend using too. Passive is the default mode for this client.

Filenames and Quoting

DOS does not allow a filename to have a space in it. However, you may find that FTP servers running real operating systems do support filenames and directory names with spaces in them.

FTP supports adding quotes around filenames and directory names so that you can work with these servers. (You still have to provide a legal DOS filename for receiving files.)

If you need to specify a filename that has the double quote character in it use two double quote characters in a row. This will result in one double quote character being sent. If you have to deal with embedded spaces at the same time, add an extra set of quotes to enclose the entire parameter.


You enter      The server sees
"Spacey name"      Spacey name (All one parm)
""QuoteChar""      "QuoteChar" (All one parm)
""Quote Char""      Uh oh .. you get "Quote as one parm and Char" as the second parm. That is because the two sets of double quotes collapse into a single double quote, but do not do anything to mark it all as one parameter.
"""Quote Char"""      "Quote Char" (All one parm). Note the usage of the triple quote

Command line editing

If you are using FTP interactively you can take advantage of the command line editor. It does all that you would expect it to do: backspace, delete, insert, home, end, etc. It also includes a ten line command buffer so that you can recall older commands easily without retyping them.

Scripting support

FTP will take input from a file redirected to stdin. This allows you to automate some simple tasks, like logging in to fetch a file.

Here are some notes for using this support:

Advanced Configuration Parameters

The following are optional configuration settings that you can put in your mTCP configuration file. See SETUP.TXT for how to make changes to that file.


Set the timeout for a socket connection to n seconds. The default timeout is 10 seconds.


Set the size of buffer used by TCP for receiving data to n bytes. The default is 8192 bytes. For best performance this should be set to a multiple of 1024 (1KB). The default is reasonable compromise between size and performance. You can go lower to conserve memory or up to 16384 bytes to improve performance.


This controls the size of the buffer used to store data when receiving a file. The default is 8192 bytes. For best performance this should be set to a multiple of 1024 bytes. The default is a reasonable compromise between size and performance. The maximum size is 32768 bytes.


This controls the size of the buffer used to read file data that is being sent by the FTP client. The default is 8192 bytes. For best performance this should be set to a multiple of 1024 bytes. The default is a reasonable compromise between size and performance. The maximum size is 16384 bytes.

(Sending a file requires less file buffering than receiving a file. Too large of a read buffer actually hurts performance, which is why the maximum size is set to 16384 bytes.)


When you use MGET or MPUT FTP has to fetch a list of files from the server or from your local machine. This buffer holds that list of files. If the list of files is too long the MGET or MPUT command will fail.

One solution is to change your filespec so that the list of be transfered is smaller, and use multiple MGET or MPUTS to do what you need. The other solution is to increase this buffer size. The default size is 4096 bytes, which is plenty for most usage. The maximum size is 16384 bytes.


Nothing is perfect but we can try ...

The FTP client is part of the mTCP project which features a TCP/IP library for DOS and several TCP/IP applications that use the library. The applications include a DHCP client, a Telnet client, an IRC client, an FTP server, Ping, Netcat, an SNTP client, and an HTTP file fetcher. All of the software is open source and is licensed under the GPL, version 3. More information about mTCP can be found at the mTCP project page.

Have a comment or need help? Please email me at mbbrutman at

Recent changes

Link: mTCP main project page

Created January 18th, 2009, Last updated December 23nd, 2013
(C)opyright Michael B. Brutman, mbbrutman at