Date Last Modified

This is a discussion on Date Last Modified within the Windows Programming forums, part of the Platform Specific Boards category; HI, I have written an FTP back up program. I want this program to compare the date last modified of ...

  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    35

    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

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    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.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Sep 2004
    Posts
    35
    What is CRC's?

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    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
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Registered User
    Join Date
    Sep 2004
    Posts
    35
    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

  6. #6
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Have you given FtpFindFirstFile a try? This should return last modified time for a given FTP file.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Advancing day by day until it matches a second date
    By nhubred in forum C++ Programming
    Replies: 1
    Last Post: 05-30-2009, 08:55 AM
  2. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  3. CDate Class - handle date manipulation simply
    By LuckY in forum C++ Programming
    Replies: 5
    Last Post: 07-16-2003, 08:35 AM
  4. Last modified date?
    By Hoxu in forum C++ Programming
    Replies: 3
    Last Post: 11-15-2001, 11:32 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21