How to bulk transfer many files over FTP using PHP
Have you ever wanted to transfer/upload many files using FTP, and sat there for hours watching the process and hoping that your FTP connection doesn’t time out?? Well, I have. This especially happens when I am uploading images, or a CMS. Well, I learned a little trick from Bo on how to use zipped files and PHP to make the file transfer process less painful.
This is how you do it:
Step 1: Zip everything you want copied.
Step 2: Upload the Zip file.
Step 3: Create a PHP file in the same directory called unzip.php and put this code in it:
<?php<br /> echo '</p> <pre>';<br /> system('unzip your_file.zip');<br /> ?>
Step 4: Run the PHP file in a browser (you should see the unzip output).
Step 5: Remove the zip file and the unzip.php file from your server.
Step 6: Rejoice that you just saved yourself a hour of waiting!
Isn’t that nice?