Would FILETOSTR() help? Why do this with RUN?
lcFinal = FILETOSTR('file1.txt')+FILETOSTR('file2.txt')+FILETOSTR('file3.txt')
STRTOFILE(lcfinal,'newfile.txt')
Or
CREATE CURSOR __newfile (mmemo m)
select __newfile
append blank
append memo mmemo from 'file1.txt'
append memo mmemo from 'file2.txt'
append memo mmemo from 'file3.txt'
COPY MEMO mmemo to 'newfile.txt'
>Hi !!
>
>Objective - to take data from 3 different tables - header, detail and footer and merge it into one file - and move the file into a sub directory - with a customized file name
>
>e.g. - move 2g011304.txt .\gefu\2g011304.txt - which works at the command prompt - the same thing when it is executed in VFP using the run command - returns a bad command or file name message.
>
>Code to achieve this
>
> RUN TYPE &vheader >>&vFinalGefu ' merging files
> RUN TYPE &vdetail >>&vFinalGefu ' merging files
> RUN TYPE &vfoot >>&vFinalGefu ' merging files
>
>
>This command - returns a bad command or filename message - in the command prompt - also part of the .prg file - which is being run
>
> run move &vfinalgefu &vto 'Code to move a file (with a derived filename) into a subdirectory
>
>where - vfinalgefu = "2g011304.txt" and vto= ".\gefu\2g011304.txt"
>
>What could be the possible reason ?? - for this msg and Also - is there a better way - of achieving this
>
>
>Rgds,
>
>KB
Wayne Myers, MCSD
Senior Consultant
Forte' Incorporated
"The only things you can take to heaven are those which you give away" Author Unknown