PHP Classes

PHP FTP Sync: Synchronize files and folders over FTP

Recommend this page to a friend!

  Detailed description   Download Download .zip .tar.gz   Install with Composer Install with Composer  
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.

Example

<?php
/*
    File : FTP_SYNC_EXAMPLE.PHP
    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 (jsaman.59@gmail.com)
    Used and owned by www.ephotobay.com
    Licensed Under Non-Profit Open Software License 3.0 (Non-Profit OSL 3.0)
*/

include_once 'ftp_sync.php';

$ftpServer='hostname';
$ftpUsername='username';
$ftpPassword='password';

//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.
$maxConnections=5;

//a comma separated list of folder names or file names - full name is required
$exclude_list='cache,template_c';

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

//This to display detailed information about the directories and files being uploaded - use for testing
$sync->verbose=true;

//start synchronization process
$sync->syncRemoteDir('/path/to/local','/path/to/remote');

?>



  Author Author  
Picture of John Saman
Name: John Saman <contact>
Classes: 1 package by
Country: Egypt Egypt
Age: 38
All time rank: 161714 in Egypt Egypt
Week rank: 587 Up6 in Egypt Egypt Up

Details
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

  Classes of John Saman  >  PHP FTP Sync  >  Download Download .zip .tar.gz  >  Support forum Support forum (4)  >  Blog Blog  
Name: PHP FTP Sync
Base name: ftp-sync
Description: Synchronize files and folders over FTP
Version: 1.0.1
PHP version: 5.0
License: Free for non-commercial use
All time users: 1794 users
All time rank: 2182
Week users: 0 users
Week rank: 196 Equal
 
  Groups   Rate classes User ratings   Applications   Files Files  

  Groups  
Group folder image Networking Networking protocols, clients and servers View top rated classes
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Files and Folders Listing, accessing and manipulating files and folders View top rated classes


  User ratings  
RatingsUtility Consistency Documentation Examples Tests Videos Overall Rank
All time: Good (90%) Good (85%) Good (83%) Good (80%) - - Sufficient (69%) 429
Month: Not yet rated by the users

  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  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

Install with Composer Install with Composer - Download Download all files: ftp-sync.tar.gz ftp-sync.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
  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

Install with Composer Install with Composer - Download Download all files: ftp-sync.tar.gz ftp-sync.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.