[AccessD] A2003: Merging top 50 files then next 50 files and so on

Stuart McLachlan stuart at lexacorp.com.pg
Mon Aug 4 20:35:19 CDT 2008


Something like this? (Aircode so will probably need a fair of checking/cleaning up)

Dim lngCounter as Long
Dim lngFileCounter as Long
Dim strFile as String
DIm strMergeFile as String

strMergeFile = "MergeFile01"
open strMergeFile for Output as #1
strFile = Dir$("*.*")
Do
	open strFile for Input as #2
	While not eof(2)
		line input #2, strtemp
		Print #1, strtemp
	Wend
	close #2
	lngCOunter = lngCounter + 1
           if lngCounter = 50 then
		lngFileCounter = lngFileCounter +1
           		lngCounter = 0
		close #1
		strMergeFile = "MergeFile" & Format(lngCounter,"00")
		open strMergeFile for Output as #1
           end if
          strFile = Dir$
Loop until strFile =""


On 5 Aug 2008 at 9:46, Darren D wrote:

> Hi Team
> 
>  
> 
> >From approx 5000 files I need to create approx 10 'blocks' of 50 files in each
> block
> 
> I want to be able to get say the first 50 files in a folder - merging those 50
> files into one file 
> 
> Then getting the next 50 and merging that lot into a second merged file etc and
> so on
> 
> I can do the merge bit OK 
> 
> Does anyone have a clue on how to get the first 50 then the next 50 and so on
> until all files have been merged into a handful of larger merged files?
> 
>  
> 
> FYI - they will all be individual XML files being merged into larger XML files
> to speed up internal processes here 
> 
>  
> 
> MTIA
> 
> 
> Darren
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com





More information about the AccessD mailing list