Thank for your helping, I known function SetFileTime but it can not apply
here because two reasons:
1. Client only connect with server by FTP protocol, not by shared folder.
2. FTP Server run in Linux, not Windows.
Regards.
**************************************************************
Le Huu Duc
E-mail: lhduc@f...
**************************************************************
----- Original Message -----
From: "Seth Bembeneck" <sbembeneck@c...>
To: "professional vb" <pro_vb@p...>
Sent: Thursday, November 15, 2001 12:29 PM
Subject: [pro_vb] Re: Modified time that the file was last written to
> Here is an example. I hope it helps. I got this from a program call API-
> Guide which you can get from http://www.allapi.net/.
>
> 'This project needs a Common Dialog box, named CDBox.
> ' (To add the Common Dialog Box to your tools menu, go to Project-
> >Components (or press CTRL-T)
> ' and select Microsoft Common Dialog control)
> Private Type FILETIME
> dwLowDateTime As Long
> dwHighDateTime As Long
> End Type
> Private Type SYSTEMTIME
> wYear As Integer
> wMonth As Integer
> wDayOfWeek As Integer
> wDay As Integer
> wHour As Integer
> wMinute As Integer
> wSecond As Integer
> wMilliseconds As Integer
> End Type
> Private Const GENERIC_WRITE = &H40000000
> Private Const OPEN_EXISTING = 3
> Private Const FILE_SHARE_READ = &H1
> Private Const FILE_SHARE_WRITE = &H2
> Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA"
> (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal
> dwShareMode As Long, ByVal lpSecurityAttributes As Long, ByVal
> dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal
> hTemplateFile As Long) As Long
> Private Declare Function SetFileTime Lib "kernel32" (ByVal hFile As Long,
> lpCreationTime As FILETIME, lpLastAccessTime As FILETIME, lpLastWriteTime
> As FILETIME) As Long
> Private Declare Function SystemTimeToFileTime Lib "kernel32" (lpSystemTime
> As SYSTEMTIME, lpFileTime As FILETIME) As Long
> Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As
> Long) As Long
> Private Declare Function LocalFileTimeToFileTime Lib "kernel32"
> (lpLocalFileTime As FILETIME, lpFileTime As FILETIME) As Long
> Private Sub Form_Load()
> 'KPD-Team 1998
> 'URL: http://www.allapi.net/
> 'KPDTeam@A...
> Dim m_Date As Date, lngHandle As Long
> Dim udtFileTime As FILETIME
> Dim udtLocalTime As FILETIME
> Dim udtSystemTime As SYSTEMTIME
> m_Date = Format(Now, "DD-MM-YY")
>
> 'Set the dialog's title
> CDBox.DialogTitle = "Choose a file ..."
> 'Set the dialog's filter
> CDBox.Filter = "All Files (*.*)|*.*"
> 'Show the 'Open File'-dialog
> CDBox.ShowOpen
>
> udtSystemTime.wYear = Year(m_Date)
> udtSystemTime.wMonth = Month(m_Date)
> udtSystemTime.wDay = Day(m_Date)
> udtSystemTime.wDayOfWeek = WeekDay(m_Date) - 1
> udtSystemTime.wHour = Hour(m_Date)
> udtSystemTime.wSecond = Second(m_Date)
> udtSystemTime.wMilliseconds = 0
>
> ' convert system time to local time
> SystemTimeToFileTime udtSystemTime, udtLocalTime
> ' convert local time to GMT
> LocalFileTimeToFileTime udtLocalTime, udtFileTime
> ' open the file to get the filehandle
> lngHandle = CreateFile(CDBox.Filename, GENERIC_WRITE, FILE_SHARE_READ
> Or FILE_SHARE_WRITE, ByVal 0&, OPEN_EXISTING, 0, 0)
> ' change date/time property of the file
> SetFileTime lngHandle, udtFileTime, udtFileTime, udtFileTime
> ' close the handle
> CloseHandle lngHandle
> MsgBox "The date of the file '" + CDBox.Filename + "' has been changed
> to" + Str$(m_Date), vbInformation + vbOKOnly, App.Title
> End Sub
>
>
>
> >
> >
> > This is a multi-part message in MIME format.
> >
> > ------=_NextPart_000_002D_01C169F9.5286BE60
> > Content-Type: text/plain;
> > charset="iso-8859-1"
> > Content-Transfer-Encoding: quoted-printable
> >
> > Dear All,
> > I am building a backup system and I save files in a FTP server. From
> > client I put file in server by Win API FTPPutFile. Anybody can tell me
> > how to modified the time the file was created in server to set the same
>
> > as file in client. I need that to compare time between server and client
>
> > when I restore later, for ex. I will not overwrite if the file in server
>
> > is older than the file in client.
> > Thanks very much.
> > **************************************************************
> > Le Huu Duc
> > E-mail: lhduc@f...
> >
> > **************************************************************
> >
> >
> > ------=_NextPart_000_002D_01C169F9.5286BE60
> > Content-Type: text/html;
> > charset="iso-8859-1"
> > Content-Transfer-Encoding: quoted-printable
> >
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> > <HTML><HEAD>
> > <META content=3D"text/html; charset=3Diso-8859-1"
> > http-equiv=3DContent-Type>
> > <META content=3D"MSHTML 5.00.3315.2870" name=3DGENERATOR>
> > <STYLE></STYLE>
> > </HEAD>
> > <BODY bgColor=3D#ffffff>
> > <DIV><FONT face=3DVNI-Times>Dear All,</FONT></DIV>
> > <DIV><FONT face=3DVNI-Times>I am building a backup system and I save
> > files in a
> > FTP server. From client I put file in server by Win API
> > FTPPutFile. Anybody
> > can tell me how to modified the time the file was created in
> > server to set
> > the same as file in client. I need that to compare time between server
> > and
> > client when I restore later, for ex. I will not overwrite if the
> > file in
> > server is older than the file in client.</FONT></DIV>
> > <DIV><FONT face=3DVNI-Times>Thanks very much.</FONT></DIV>
> > <DIV><FONT
> > face=3DVNI-
> Times>********************************************************
> > ******<BR>Le
> > Huu Duc <BR>E-mail: <A
> >
> href=3D"mailto:lhduc@f...">lhduc@f...</A><BR>
> >
> <BR>**************************************************************<BR></D
> > IV></FONT>
> ---<BR>
> You are currently subscribed to pro_vb as: lhduc@f...<BR>
> To unsubscribe send a blank email to $subst('Email.Unsub')<BR>
>
> </BODY></HTML>
> >
> > ------=_NextPart_000_002D_01C169F9.5286BE60--
> >