function copyfile lparameters lcSource, lcDestination, lnMaxTries, lnWait * lcSource: name of source file * lcDestination: name of destination file * lnMaxTries: maximum attempts to copy file, defaults to 1 try * lnWait: time to wait between attempts, in seconds. Defaults to 10 seconds. * need to add better parameter checking, such as on validity of lcDestination local lcOldError, llSuccess, lnTries if not file(lcSource) error "Source file does not exist...cannot copy file." return .f. endif if empty(lnMaxTries) lnMaxTries = 1 && default number of tries endif if empty(lnWait) lnWait = 10000 && defaults to 10 seconds between tries else lnWait = lnWait * 1000 endif declare Sleep in Win32API integer nMilliseconds lcOldError = on("error") lnTries = 0 llSuccess = .f. on error llSuccess = .f. do while not llSuccess and lnTries < lnMaxTries lnTries = lnTries + 1 llSuccess = .t. copy file (lcSource) to (lcDestination) if not llSuccess and lnTries < lnMaxTries =sleep(lnWait) endif enddo on error &lcOldError return llSuccess endproc>Steve