Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2007
    Posts
    49

    Copying files incrementally

    Hi

    I need to backup a large quantity of files to a destination where many already exist, so I only want to copy new or modified files. AMS7 only allows not to overwrite a file if the name is the same. Anybody know how can I tell it to overwrite if the name is the same, but date is newer?

  2. #2
    Join Date
    May 2007
    Location
    Sydney, Australia
    Posts
    1,546
    File.GetAttributes will return the files' creation-date down to minutes and seconds, if you use CreationDateISO in the table.

    eg.
    Code:
    fSelect = Dialog.FileBrowse(true, "File to Copy", _DesktopFolder, "All Files (*.*)|*.*|", "", "dat", false, false);
    attrib = File.GetAttributes(fSelect[1]);
    strCreationDateISO = attrib.CreationDateISO;
    Dialog.Message("Notice", strCreationDateISO, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    An if/then statement to compare the 2 files in question, will allow you to copy the newer file.

    But the only problem that I can't figure out is how to convert the date formats into comparable-strings. Perhaps someone else can jump in here.

  3. #3
    Join Date
    Aug 2003
    Posts
    2,427
    Quote Originally Posted by mystica View Post
    But the only problem that I can't figure out is how to convert the date formats into comparable-strings. Perhaps someone else can jump in here.
    You can compare directly once you've got the .CreationDateISO for both files.

    If the files are from the same originals and the new ones have simply been updated with new information it would probably be better to compare the .WriteDateISO

  4. #4
    Join Date
    Jan 2007
    Posts
    49

    Copying files incrementally

    Thanks a lot guys
    Thats great advice - I'll give it a go and I might be able to use the DateDiff plugin to compare the dates. I'll let you know how I get on.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts