Matthias,

there are many recipes for sync, it all amounts on how perfect you
want your sync to be. Changed files probably have a different
timestamp and different size then their server siblings, so one way is
to compare both size and timestamp. You can do that by FTP by using
the libURLFtpCommand() call. The SIZE ftp command should return the
size of the file in bytes, not all servers understand this command,
you need to try. As for finding the date, this is a little trickier. I
don't recall FTP having a command to return the time stamp of the
file, some FTP servers will return the time stamps as a part of the
LIST command but parsing those is not trivial as they differ from
system to system, mostly they look like the output of 'ls -l' on a
unix machine.

If anyone here remmebers how to the get a date from a file using the
command line, you can try to pass that command to the FTP server using
the SITE command which is like the shell() call used in rev, for
example, FTP has not way to set file attributes but with something
like:

   libURLFTPCommand("SITE CHMOD 755 myfile", "ftp.example.com")

you can set the attributes to 755. I don't know if SITE will accept
anything, this could be a security risk as someone could issue 'SITE
killall ftpd' and if he has the correct perms he would shutdown the
server.

If I can tell you a simple advise, I'd go like this, I'd make a file
that is an index and holds metadata information about the files, this
file would contain the size and modification dates for the files, so
to sync, I'd download this index file and compare it with the local
copy. When syncing, I'd generate a new up to date index file and
upload it. Much easier than handling SITE, SIZE and the like.

andre

On 12/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi,
>
> i have to sync a local folder with about 5000 files with a ftp folder.
> If a new file is in the local folder or if a file has changed it has to be 
> uploaded to the ftp folder.
>
> Okay, if i only had to upload new files, i could compare the files of the 
> local and the remote folder. But i also have to upload changed files.
> Problem here is, that files stored on the ftp shows their modification 
> date/time with 1 hour difference.
>
> Has anyone done such sync things already?
>
> Matthias
>
>
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>


-- 
http://www.andregarzia.com All We Do Is Code.
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to