I use windows, mysql db, php
I am creating a Joomla component, one of which is folder synchronization. I want to synchronize two folders with a different name. How can i do this? It must be on the same machine, it does not involve two different servers.
How to synchronize two folders in PHP?
UPDATED
In the context of Alex Reply
What if I edit any .jpg file in one folder and save it with the same name as him, this file is already present in another folder. And I want this edited pic to be moved to another folder.? I also have a structured Joomla file structured for comparison
UPDATE 2
I have a recursive function that displays me the full folder structure ... if you can just use it to solve concat ur in ...
<?
function getDirectory($path = '.', $ignore = '') {
$dirTree = array ();
$dirTreeTemp = array ();
$ignore[] = '.';
$ignore[] = '..';
$dh = @opendir($path);
while (false !== ($file = readdir($dh))) {
if (!in_array($file, $ignore)) {
if (!is_dir("$path/$file")) {
$stat = stat("$path/$file");
$statdir = stat("$path");
$dirTree["$path"][] = $file. " === ". date('Y-m-d H:i:s', $stat['mtime']) . " Directory == ".$path."===". date('Y-m-d H:i:s', $statdir['mtime']) ;
} else {
$dirTreeTemp = getDirectory("$path/$file", $ignore);
if (is_array($dirTreeTemp))$dirTree = array_merge($dirTree, $dirTreeTemp);
}
}
}
closedir($dh);
return $dirTree;
}
$ignore = array('.htaccess', 'error_log', 'cgi-bin', 'php.ini', '.ftpquota');
$dirTree = getDirectory('.', $ignore);
?>
<pre>
<?
print_r($dirTree);
?>
</pre>