-
Date Last Modified
HI,
I have written an FTP back up program. I want this program to compare the date last modified of the local file with the file on the server and only transfer the file if the date is different.
Problem, When I FTP the file from the server, the date created and modified is the time the FTP occured, making it impossible to compare this file with the original at a later date.
So my question, Can and change the last modified date of a file?
Mike
VC++
WinXP
-
Could
GetFileTime()
modify the FILETIME struct
SetFileTime()
Better to do this with CRCs. ie if CRC is diff, change files.
Then you can 'roll back' a file if the new one proves to be a problem.
-
-
CRC = Cyclic Redundancy Check
simply..... a number representing the sum of all the bytes in a file.
something like..
Code:
//init the CRC array called pdwCrc32Table
//read the file into a buffer called byteBuffer
//file size is called dwBytesRead
//the CRC is dwCrc32
for(UINT i=0;i<dwBytesRead;i++)
dwCrc32 = ((dwCrc32) >> 8) ^ pdwCrc32Table[(byteBuffer[i]) ^ ((dwCrc32) & 0x000000FF)];
try a search or google for more
-
Many thanks - I found a site with CRC algorithims, which work fine, but I cant test a file on the server without downloading it, which defeats the point, as I only want to download files that have changed, for speed issues - any ideas?
Many Thanks
Mike
-
Have you given FtpFindFirstFile a try? This should return last modified time for a given FTP file.