Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to concatenate SDF files?
Message
From
28/09/2002 04:57:50
 
 
To
27/09/2002 20:08:22
Henry Ravichander
RC Management Systems Inc.
Saskatchewan, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00705004
Message ID:
00705537
Views:
49
>> 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\'  && this is the BW subfolder of the Current Working Directory
#DEFINE SOURCEFILEMASK = 'PROCESS*.DAT'
cConCatString = ''
nFiles = ADIR(aBWFiles,SOURCEPATHNAME + SOURCEFILEMASK)
FOR i = 1 TO nFiles  && this avoids all copies if no files were found
   cConCatString = cConCatString + FILETOSTR(SOURCEPATHNAME + aBWFiles[i,1])
ENDFOR
=STRTOFILE(cConCatString,'MyConCatFile.DAT',.F.)  && .T. would append to any existing MyConCatFile.DAT found
RELEASE cConCatString  && releases the large string memory allocation
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform