Hi Rushabh,
On Dec 29, 5:44 am, rushabh <
rme...@gmail.com> wrote:
> Is there any specific reason why do you need to update the time of the
> local file during upload? I have a 100+ image files that do not change
> often and whenever I upload them to another server, it changes the
> date. So when I upload to an existing server, it will re-upload them.
Yes, the reason is that ftpsync2d uses the time of a remote file
as a reference time to decide if the file needs to be uploaded or
downloaded
or if the local and remote files are the same. So, the modification
time (mtime)
of a file is used to keep the remote and local files in sync. This was
the
only method that I found working reliably for keeping files in sync
in situations when only the ftp protocol can be used.
Note that the modification time of local files cannot be used as
reference
because when uploading the file, the modification time of the remote
file will set to the time of uploading, not to the mtime of the local
file,
and I didn't find a way to change the mtime of the remote file with
ftp.
So, ftpsync2d uses the mtime of the remote file as reference and
the mtime of the local file will be set accordingly to indicate that
the files are equal.
> I am trying to use it in my web-app framework.
Do you actually need bidirectonal connection? That is, the files can
be modified both by your local computer and the two servers.
If so, then using another server may complicate things since there is
no unique way to determine where is the most updated version
of a file, especially when using one remote server as the reference
file
repository and when with ftp there is no way to update mtime of remote
files.
If your servers support rsync then I would suggest using
rsync to keep files in sync on different servers. rsync would compare
the local and remote files directly to decide if the files are
different or
not, though I have not checked how rsync could be used in
bidirectional way..
Regards,
Pearu