LifebloodNetworks.com Projects

ncopy


ncopy is a PHP-based command-line backup tool.

ncopy will sync a destination directory with a source directory. ncopy will only sync what files do not exist in the destination or have changed since last sync. ncopy will maintain file modification times.


Why?

I wrote this utility because I go through a lot of pen drives. In order to back them up I used xcopy on Windows (see where I got the name from?). Although xcopy worked well the larger my pen drives got the more inefficient xcopy got. Why should I backup things already backed up? What if I removed something off my pen drive and just wanted a clean backup without starting all over again? ncopy solves these problems.

PHP may not seem like an obvious choice but there is much to be considered. PHP 5 is surprisingly fast-- and not only for a scripting language. It is no C but it is not Java or VB either. As ncopy grows I try to pack as many features into it as I can. PHP already has native support for such things as MD5 hashes (hint, hint) and transparent FTP support. PHP is cross platform. Without a re-compile. PHP is open-source in its very nature as a script.

Perhaps I will make a simplified C++ version down the road.

I dare anyone to do a speed comparison against xcopy with the equivalent switches.


Features


Possible to-do's for Future Versions


Known Limitations


Known Issues


Usage

php.exe ncopy.php /? | -?
php.exe ncopy.php source destination mask [-r] [-s] [-w] [-v | -vv] [-q]
/? -? This help message
source Source directory to sync from
destination Destination directory to sync to
-r Traverse directories recursively
Default will only sync current directory
-s Do not stop on error
Default will stop on errors
-w Do not display warnings
-v Verbose mode
Display message when files are deleted
Default only shows when files copied
-vv Very verbose mode
Display message when directories are synced
Implies -v
-q Quiet mode

Download

I recommend 7-Zip.

The "Ready-to-Go" (RtG) release includes everything you need. Just edit the batch file as required.

Warning
Although I have spent much time testing whatever I could think of this software comes with no guarantee. ncopy may delete all your files and/or do other bad things.


Version History


Version History Key


Requirements

PHP CLI [php.net]

Tested with the PHP 5.2.0 CLI on Windows 2000 Professional SP4 and Windows XP SP2.

Tested with the PHP 5.2.1 CLI and verified not working.


Additional Credits

soywiz at php dot net for the fnmatch() alternative