|
Function UnSplitFile(ByVal SourceMask As String, DestFile As String, _ Optional Assume8Dot3 As Boolean = False)
'//UnSplitFile function - Copyright (C)1997-1999 michiel de bruijn <mdb@x42.net> '//Redistribution permitted, provided this comment block is left intact '//For full licensing terms, see http://www.x42.net/Code/license.html
Dim CurFile As String, hDestFile As Long, hCurFile As Long, Blocks As Long Dim CurBlockSize As Long, LastBlockSize As Long, i As Long, Buffer As String Dim SourceDir As String, x As Long Const BLOCKSIZE = 32768
SourceMask = SourceMask & ".???" If Not Assume8Dot3 Then SourceMask = SourceMask & "~"
x = InStrRev(SourceMask, "\") If x = 0 Then SourceDir = ".\" Else SourceDir = Left(SourceMask, x) End If
hDestFile = FreeFile Open DestFile For Binary As #hDestFile
CurFile = Dir(SourceMask) While Len(CurFile)
'//Determine # of blocks in this chunk, and do the append thing hCurFile = FreeFile Open SourceDir & CurFile For Binary As #hCurFile Blocks = LOF(hCurFile) \ BLOCKSIZE CurBlockSize = BLOCKSIZE LastBlockSize = LOF(hCurFile) Mod BLOCKSIZE For i = 1 To Blocks + 1 If i = Blocks + 1 Then CurBlockSize = LastBlockSize Buffer = Space(CurBlockSize) Get #hCurFile, , Buffer Put #hDestFile, , Buffer Next Close #hCurFile
CurFile = Dir() Wend
Close #hDestFile
End Function
|