Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Copy File if Newer Function..
Message
De
23/01/2003 19:54:04
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
23/01/2003 16:53:35
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00744883
Message ID:
00744937
Vues:
10
>Anyone have a "copy file if newer function"?
>
>I need to copy a bunch of files that may exist if they do I only want to copy them if the file date is newer (ie the file is changed) which I'm hoping will save time...

If you want to copy an entire directory (rather than a previously specified list), you may want to use adir().

>So far i got:
>
>FUNCTION CopyFileIfNewer
>LPARAMETERS lcSource,lcDest
>LOCAL lcError,lok
>
>	lok=.F.
>	IF !FILE(lcSource)
>		RETURN .F.
>	ENDIF
>	
>	IF !FILE(lcDest)
>		COPY FILE (lcSource) TO (lcDest)
>		RETURN .T.
>	ENDIF
>	
>	IF FDATE(lcSource)<>FDATE(lcDest) OR (FDATE(lcSource)=FDATE(lcDest) AND FTIME(lcSource)<>FTIME(lcDest))
>		COPY FILE (lcSource) TO (lcDest)
>		RETURN .T.
>	ENDIF
>RETURN lOk
>
If you use the code above, better change RETURN .T. to lOk = .T.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform