PHP Classes

PHP FTP Sync: Synchronize files and folders over FTP

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (4)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 64%Total: 1,809 All time: 2,174 This week: 63Up
Version License PHP version Categories
ftp-sync 1.0.1Free for non-comm...5.0Networking, PHP 5, Files and Folders


This class can synchronize files and folders over FTP.

It connects to a given FTP server and it knows how to synchronize files of a local folder with the remote files of a folder in the FTP server.

The class only copies the new and modified local files to the remote server after last time folder synchronization was run.

It can also exclude a given list of directories and files from being synchronized.

Picture of John Saman
  Performance   Level  
Name: John Saman <contact>
Classes: 1 package by
Country: Egypt Egypt
Age: 39
All time rank: 161414 in Egypt Egypt
Week rank: 305 Up5 in Egypt Egypt Up


    Ver. : 1.0.0
    Desc.: The class is made to work as an alternative to rsync when FTP is only available.
        The class use FTP to do synchronization to the target FTP host.
        It copies only the new and modified files after last run of the script.
        You can specify exclude list to the class and any directories or files in this list will be ignored from synchronization.

    Developed By John Saman (
    Used and owned by
    Licensed Under Non-Profit Open Software License 3.0 (Non-Profit OSL 3.0)

include_once 'ftp_sync.php';


//max simulatnous connections. the more of this number the faster synchronization will be but if set to high number it'll be aborted by FTP server probably so try to keep it in between.
//Note: if it's getting connection refused error try to set this number to low number usually 5 should be fine.

//a comma separated list of folder names or file names - full name is required

$sync=new FTPSync($ftpServer,$ftpUsername,$ftpPassword,$maxConnections,$exclude_list);

//This to display detailed information about the directories and files being uploaded - use for testing

//start synchronization process



Notes before using this class:- 1- Please don't write ftp:// before the host name or it will fail. 2- If you had troubles connecting to the FTP server or if the synchronization is taking too long try decreasing the number of maxConnections to 1 or 2 because some servers refuse multiple connections from the same client. 3- Some servers doesn't support chmod options so you may get errors like PHP Warning: ftp_chmod(): Unknown SITE command. Just can ignore this error

  Files folder image Files  
File Role Description
Plain text file ftp_sync.php Class FTP Synchronizer Class
Accessible without login Plain text file ftp_sync_example.php Example FTP Synchronizer Example
Accessible without login Plain text file readme.txt Doc. Please read this file before using the class

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:2,174
This week:63Up
User Ratings User Comments (1)
 All time
Top, exactly what i wanted.
6 years ago (Pitt Roscher)