this topis was started with FTP sync problem not SCP
this topis was started with FTP sync problem not SCP
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
#!/usr/local/bin/php -d safe_mode=off
<?php
/*
Used to create a directory list with timestamps, that can be
used with WinSCP synchronization functions.
Note that file permissions are allways reported as rw-rw-r--, timezone is hardcoded and
only dirs and links are detected - all other entries are regarded as normal files.
*/
$path = getcwd();
for ($i=1;$i<$argc;$i++) if (substr($argv[$i], 0, 1) != '-') $path = $argv[$i];
//echo("Path: $path\r\n");
$files = scandir($path);
foreach ($files as $file) {
$info = stat($path.'/'.$file);
$user = posix_getpwuid($info['uid']);
$group = posix_getgrgid($info['gid']);
$perms = fileperms($path.'/'.$file);
if (is_dir($file)) echo('d');
else if (is_link($file)) echo('l');
else echo('-');
printf("rw-rw-r-- %10d %10s %10s %10s %s %s\n", $info['ino'], $user['name'], $group['name'], 1*$info[7], date('Y-m-d H:i:s', $info[9]).'.000000000 +0200', $file);
}
Yes, it's definitely a time synchronization problem when using SCP.
I replaced the listing command (ls -la) with a small perl hack, that always shows the date as 2008-01-01 and now all files are allways uploaded when a change occur.
The remote system is running tcsh on FreeBSD, and the output of "ls -la" is in the format:
-rw-r--r-- 1 user group 1214 Aug 5 15:15 index.php
While "ls -laT" is in the format:
-rw-r--r-- 1 user group 1214 Aug 5 15:15:16 2008 index.php
And my "fake" list output is:
-rw-r--r-- 1 user group 1214 2008-01-01 00:00:00.000000000 +0200 index.php
This is most likely caused by synchronization problems, but my thought was: Why synchronize at all?
If the local and remote directory has initially been synchronized, why not just transfer the file anytime a change is detected in the local directory?