HTTrack Website Copier
Free software offline browser - FORUM
Subject: Not change file if it's to be updated w. callbacks
Author: Juan Fco Rodriguez
Date: 05/24/2005 12:36
 
Hello,

I would like to detect the situation where a file
needs to be updated. If that is the case, I would like
to not overwrite that file, instead I would rename the file
using a suffix like "<original_nam>_newFile".

I'm newbie to httrack. I've been looking at the callback's
functionality. If I use "transfer-status" to check if
"back.r.notmodified" is 0, then I can check again for
"if( fsize(back->url_sav) > 0)". If this is true, it means
that there is already a file, so I would apply "_newFile"
suffix to "url_sav" in order to not overwrite the original file.

The problem is that this scheme doesn't work for me.
should it work ? it seems that "save-name" is called
before "transfer-status", because when I modify the
"back->url_sav" inside "transfer-status", it doesn't
affect the end result, I mean, the file is not stored
as "<name>_newFile".

Here is the code in case I am missing something:

/* Implementations */
EXTERNAL_FUNCTION int transfer_status(lien_back* back)
{
 printf("notmodified: %d\n", back->r.notmodified);
                                                                                                

 if( ! back->r.notmodified ) {
    if( fsize(back->url_sav) > 0 ) {
       strcat(&(back->url_sav), "_newSbÑÑÑ_");
    }
                                                                                                

  printf("status: %d\n", back->r.statuscode);
  printf("is_update: %d\n", back->is_update);
  printf("url_adr: %s\n", back->url_adr);
  printf("url_sav: %s\n", back->url_sav);
 }
                                                                                                

 return 1;
}


Finally, I think I cannot modify the name of the file
inside "save-name" callback because I would have to 
check if it is an update and I dont have access to
"lien_back" structure in that call.

PS: I'm spaniard...what doest it mean "lien_back" ? :P




 
Reply


All articles

Subject Author Date
Not change file if it's to be updated w. callbacks

05/24/2005 12:36
Re: Not change file if it's to be updated w. callbacks

05/29/2005 16:44
Re: Not change file if it's to be updated w. callb

05/30/2005 09:54




b

Created with FORUM 2.0.11