>> How your ppogram knows what files to copy?
>
>They will be stored in the BW directory.
>
>Initially the sdf files will be generated individually and will have a comman name e.g. Process to which I plan to add a number to differentiate each sdf file e.g. Process1. If another file is generated, it will be Process2. All of these files will be stored in the BW directory.
>
>After the individual files have been generated, I plan to check for all files in the BW directory with the Name Process*.dat sdf files and then starting at the top, copy the contents of each of those files separately one after the other.
>
>Is this approach good or do you see problems with this? Thanks Sergey.
This approach works fine, as does the general suggestion that Sergey makes. I'd take a slightly different approach, calling STRTOFILE() only once and creating a memvar to hold the concatenation until writing it:
LOCAL cConCatString, aBWFile[1,5], nFiles, i
#DEFINE SOURCEPATHNAME = '.\BW\'
#DEFINE SOURCEFILEMASK = 'PROCESS*.DAT'
cConCatString = ''
nFiles = ADIR(aBWFiles,SOURCEPATHNAME + SOURCEFILEMASK)
FOR i = 1 TO nFiles
cConCatString = cConCatString + FILETOSTR(SOURCEPATHNAME + aBWFiles[i,1])
ENDFOR
=STRTOFILE(cConCatString,'MyConCatFile.DAT',.F.)
RELEASE cConCatString