Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Copy File if Newer Function..
Message
 
 
To
23/01/2003 16:53:35
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00744883
Message ID:
00744938
Views:
8
You can simplify it little bit.
...
llOk2Copy = .F.
IF FILE(lcSource) ;
       AND (NOT FILE(lcDest) OR FDATE(lcSource,1) > FDATE(lcDest,1)) 
  COPY FILE (lcSource) TO (lcDest)
  llOk2Copy = .T.
ENDIF
RETURN llOk2Copy 
>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...
>
>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
>
>
>But it doesn't feel like the best/fastest way to do it?
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform