Age of Article Warning:
This article was originally published 62 months ago. The information, tips and techniques explained may outdated. Examples shown on this page may no longer work. Please consider this when viewing the below content.
A quick way to download a website’s files using FTP, is to compress them at the server, and then download. You can do this by adding a quick and easy PHP compression script to your website, if you have access with FTP.
<?php exec('tar zcf compressedbackupwebsite.tar.gz *'); ?>
Create a PHP file called “compress-files-for-ftp.php” and add the above code into it; then upload to the public_html directory of your website, or whichever directory that you wish to compress.
Simply then run the script by loading YOUR-DOMAIN-NAME.com/compress-files-for-ftp.php in a browser URL address bar. This will trigger the script and create a new file called compressedbackupwebsite.tar.gz.
Refresh your FTP client and then download compressedbackupwebsite.tar.gz, then you can use a Zip tool like 7-Zip to extract the tar file, then extract further to extract the individual website files.
Now you will have a backup of all the files from the website.
Note that this won’t backup files that are dot files such as .htaccess files, which you will have to download manually. It also won’t backup the database files- if you have a WordPress website for example.
Be sure to delete both compressedbackupwebsite.tar.gz and also compress-files-for-ftp.php, off your website when you are finished.
Important Note: *this procedure will not work if exec has been disabled in PHP for your server.