Need for updating local time in upload

14 views
Skip to first unread message

rushabh

unread,
Dec 29, 2008, 12:44:36 AM12/29/08
to Mailing list for the ftpsync2d project
Hi Pearu Peterson,

I have been using your code for some time and found it useful :-)
Thanks!

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.

I am trying to use it in my web-app framework.

regards,
Rushabh

Pearu Peterson

unread,
Dec 29, 2008, 3:32:03 AM12/29/08
to Mailing list for the ftpsync2d project
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

Rushabh Mehta

unread,
Dec 31, 2008, 12:06:17 AM12/31/08
to ftps...@googlegroups.com
Hi Pearu,

Thanks for letting me know about rsync. I will still need to do ftp,
since I host at shared hosts and do not have shell access. I need only
one-way at the moment, so I will skip updating the local times.

Am making some changes to the code, will send it across to you once I
test it.

Happy New Year!

regards,
Rushabh
Reply all
Reply to author
Forward
0 new messages