File Transfer Protocol (FTP)
Table of Contents
Recommended basics: Articles you should know
To get the full picture of this article, you should know about this topics:
You may also want to use the content map to find interesting articles that play into this one.
One way to upload many files for your website is using the file transfer protocol (FTP). This is a standard on how to communicate with a remote storage and manage (download or upload) files there.
In the shared hosting article, the web interface of the hoster was used to transfer two single
files. If you have more files, maybe in multiple folders, it would be tedious to do it this way. In this
situation, FTP
will be a possible solution.
Understanding FTP Basics #
The FTP
is a standard to connect to a remote storage and upload or download files. To connect to such storage,
you need the server address, a username, a password and the port,
which by default is 21.
“A standard” and “a protocol” are very technical words. It can sound like FTP
is rocket science. To be honest, most
likely you’ll use a program with a nice UI, which will do the heavy lifting for you. At the end, you will have a file
browser and it will look and feel like moving files locally. So please don’t bother too much for the moment.
After you provided the details to your client application (also called FTP client
), it will connect to the server.
In case the credentials are correct, you’ll see all files and folders and you can start your job.
Using FileZilla: A graphical FTP client #
As said FTP
is no program itself, but just a definition. If you
search for “ftp client” you will find multiple choices. For this article I
will go with FileZilla, which was the first FTP client I used when I started coding
websites in 2003.
On the very top you see a bunch of icons, below you see the four details I mentioned above: server address, username, password and port.
Depending on the remote storage you connect to, you probably see a certificate warning when connecting to the remote. Since I know the shown certificate, I can accept the dialog.
And as long as you put in the correct details, now you should see the remote storage file system.
Download files and folders using FileZilla #
To download files or folders, you can simply use drag and drop or right-click and select “Download”.
Whenever there’s a file transfer running via FTP
, FileZilla will show the log output at the top and show information
about the current transfers on the bottom.
There’s many more features FileZilla offers, but since this article is a simple FTP
introduction, I’ll stop here.
Using rclone: A command line FTP client #
While UI’s are nice for manual tasks, it’s not so much useful if you want to automate these tasks. You can easily
automate FTP
tasks with rclone (which definitely worth it’s own article - stay tuned).
After installing rclone
, you can use it for example to copy a local folder.
|
|
This command will copy the folder some-folder
in your current working directory to copy-of-some-folder
.
You probably think “I can do this already” or “How is this related to FTP?”… So let’s connect rclone
via FTP
to
some remote storage.
Configure remote storage for rclone #
rclone
can save multiple remote storage configurations. To add a new remote storage, run rclone config
, press n
(for “new remote”) and confirm with enter.
In the first step, you define how you want to name the new remote, I’ll go with “ftp”.
Enter name for new remote.
name> ftp
In the second step, you can select from multiple supported remote storage protocols, I’ll go with FTP
. Hint: The
numbers can vary on your computer.
Choose a number from below, or type in your own value.
...
15 / FTP
\ (ftp)
...
Storage> 15
In the third step, you need to define the server address.
Option host.
FTP host to connect to.
E.g. "ftp.example.com".
Enter a value.
host> reliabledemo.site
In the fourth step, you need to provide the username.
Option user.
FTP username.
Enter a value of type string. Press Enter for the default (oliver).
user> f0175d42
In the fifth step, you need to specify the port to use (most probably it’s the default: 21).
Option port.
FTP port number.
Enter a signed integer. Press Enter for the default (21).
port> 21
In the sixth step, you can provide the password. There’s other options as well, for this article I’ll go with a static password.
Option pass.
FTP password.
Choose an alternative below. Press Enter for the default (n).
y) Yes, type in my own password
g) Generate random password
n) No, leave this optional password blank (default)
y/g/n> y
Enter the password:
password: ...
Confirm the password:
password: ...
The other options you can simply confirm by hitting return (you’ll use default values), until you’re back in the main
menu, where you use q
to quit the rclone config
process.
Now you’re back on the command line and you can check if the config works. To do so, you can simply list the folders of
the remote storage with the command: rclone lsd ftp:
.
In my case I’ll see this:
|
|
Download folder from remote storage via FTP using rclone #
It’s important to understand that rclone can work with multiple file systems. Your local one (see copy command we did
before), an FTP
remote storage or many others. The commands are the same. So, to download one of these folders, we
can use rclone copy ftp:html html
. This would download the html
folder from the remote storage to the current
directory.
As you can see, the command’s idea is basically rclone copy {from} {to}
. If you copy locally, you can just put any
file pathes you want. If you want to work with remote storage, you simply use {config-name}:{remote-path}
.
Upload folder to remote storage via FTP for rclone #
You probably guess it already, uploading works like downloading, you just put the local path first and the remote path
second: rclone copy html ftp:html
. This would upload the html
folder of the current directory to the remote storage.
Benchmarking FTP performance #
As you could see, FTP
offers you much room to move files from local to remote storage or vice versa. But there’s a
caveat.
Copy one or few big files can work quiet performant. But copying many small files, even if they would be smaller then the few big files, will be dramatically slow(er).
To give you an idea of how slow “slow” can be, I did a benchmark.
Setup #
I created four folders on a remote storage:
rclone lsd ftp:benchmark
-1 2025-04-11 23:38:09 -1 0001-file-10-mb
-1 2025-04-11 23:38:08 -1 0010-file-1-mb
-1 2025-04-11 23:38:22 -1 0100-file-100-kb
-1 2025-04-11 23:39:49 -1 1000-file-10-kb
All folders are 10 MB in size. The first folder has one file of 10 MB, the second one has 10 files of 1 MB each, the third one has 100 files of 100kb each and the last one has 1000 files of 10 kb each.
Disclaimer: This is not meant to be the most precise benchmark on earth. Take it with a grain of salt.
All tests do run against the same server. I have fiber internet. I do test at midnight, there’s not much traffic now. Each test is run three times.
1 File 10 MB #
Downloading 1 x 10 MB file via FTP
took 1,33 seconds in average.
- 1 second
- 1 second
- 2 seconds
10 Files 1 MB #
Downloading 10 x 1 MB files via FTP
took 9 seconds in average.
- 9 second
- 9 second
- 9 seconds
100 Files 100 KB #
Downloading 100 x 100 KB files via FTP
took 5,66 seconds in average.
- 4 second
- 4 second
- 9 seconds
1000 Files 10 KB #
Downloading 1000 x 10 KB files via FTP
took 31,66 seconds in average.
- 32 second
- 40 second
- 23 seconds
FTP is slow on many files #
As you can see in the benchmark above, FTP
is slow as more files you copy, even if the total size is identical.
Keep pushing forward: Next articles to improve your skills
With this article in mind, you can keep on reading about these topics:
You may also want to use the content map to find your next article.