Indigo Rose Software

Professional Software Development Tools

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

    File.Copy versus File.Install

    Is this a bug or not?
    I am writing a backup program, where thousands of folders & files must be backed up regularly, and will need to do an incremental backup to an already existing one, only overwriting modified files and copying new ones.
    I can't seem to use the File.Copy command, as it can only overwrite files if they have the same name, not if they've been modified, and I can't get its callback function to do it either.Any ideas?
    The File.Install command does support overwriting of files, but is much slower.
    Take the following scenerio:-
    File.Copy(Source, Destination, true, false, false, true, nil);, (where Source and Destination are pre-defined elsewhere in the script and are proven to be OK), and where there are no new/modified files to copy, will scan approx 16,000 files in 65 seconds.
    File.Install(Source, Destination, FILE_INSTALL_NEVER, false, true, nil, nil);, will take 22 mins to do the same scan.
    Surely, these 2 commands are doing the same task, so why is there such a time difference in their functionality?
    I think IR needs to do some thorough checking/testing on this.

  2. #2
    Join Date
    Apr 2005
    Location
    São Paulo, Brazil
    Posts
    2,539
    Quote Originally Posted by Mango View Post
    Surely, these 2 commands are doing the same task, so why is there such a time difference in their functionality?
    I think IR needs to do some thorough checking/testing on this.
    Clearly, these commands do not perform the same task in your case. You just need to look at the options you have set for File.Install() to see that you are setting the files are "shared", so for each file a registry entry needs to be set up, or have its reference count updated. Additionally, as you are using FILE_INSTALL_NEVER, each file is individually checked for its existence before the file is written to disk, so of course this also takes time. Without seeing the actual code, I think that is impossible to advise anything to speed up the process.

    Ulrich

  3. #3
    Join Date
    Jan 2007
    Posts
    49
    The FILE_INSTALL_NEVER was just used as an example to compare it with what File.Copy is doing. I'm actually trying to use File.Install(Source, Destination, FILE_INSTALL_CALLBACK, false, true, nil, FileCopyCB2);, but as it was running slow I thought it was the callback function slowing things down, but trying the FILE_INSTALL_NEVER proved this was not the case. Setting up a registry entry for each file is out of the question.
    How would you go about creating an incremental backup routine?
    Would it not be best if the File.Copy command had a built-in overwrite callback feature like File.Install

Posting Permissions

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