There are many cases where people want to transfer files from server A
to another server B
. Imagine moving a website from a hosting package to another one to a different provider. When working with classical webhosting packages, only FTP, sometimes SFTP, and in rare cases SSH with limited access is available.
The Problem
When looking at agencies that develop websites: How do they transfer websites to another provider? In most cases: Manually. They use FTP clients like FileZilla and download all files to their local computer. After the complete download from server A
finishes, they upload everything via client to server B
. Yes, this still works but it requires annoying manual work. Sometimes problems can occur in the download / upload process, it can take a long time when the local internet connection is slow and if the personal disk space is limited, it isn't possible to download everything from server A
at once.
Solution 1: FXP
There is a solution for this problem called File eXchange Protocol (FXP). When using an FTP client that supports FXP, it is possible to connect to server A
(mostly shown on the left half of the screen in the client) and server B
directly (mostly shown on the right half of the screen in the client). Therefore, files can be transferred from the left to the right side easily via drag-and-drop.
The problem: Most of the big server providers disabled FXP in their server configuration because it is a security risk that can lead to FTP bounce attacks. Thus, the actual solution is actually not applicable at all.
Solution 2: Own Script
Since the server providers disabled all relevant protocols, I decided to write a simple bash script that automates the download / upload process. It is available open-source at GitHub: FTP Move Server Files.
The script performs the same steps you would do manually on your local PC: It downloads the content from server A
and uploads it again at server B
. But what is the benefit of it? Most people working in this area have access to a root server / vServer / VPS. When executing the script on an external server C
, the transfer doesn't take place on the local machine. Therefore, it isn't necessary to let the own PC run over night when the file transfer takes long. Further, it protects the own hard disk by reducing the reads and writes and the local internet connection isn't the bottleneck anymore.
To install the script, follow the instructions in the README. Always remember that it is in a pretty early stage. Therefore, every contribution is highly appreciated!