
The 2 bas programs in the zip contain most of this
mdDir.bas is a bit like _Files$() but also does recursion and contains all attributes/timestamps/etc.
mdDiff.bas is high performance file compare (meant for text files, but you can use same logic for binary)
For big files (>1GB) you might want to use this function to speed things up:
Code: (Select All)
Function readBigFile~&& (file$) '1.5GB/sec
Const BLOCKSIZE = 4194304 '=64*65536 = 4 MB
If Not _FileExists(file$) Then Exit Function
Dim As _Unsigned _Integer64 fsize, blocks
fsize = fileSize(file$)
Dim mem As _MEM: mem = _MemNew(fsize + BLOCKSIZE)
Dim block As String * BLOCKSIZE '=64*65536
filenum% = FreeFile
Open file$ For Random Access Read As filenum% Len = BLOCKSIZE
blocks = fsize \ BLOCKSIZE: blocks = blocks - ((fsize Mod blocks) > 0)
$Checking:Off
For blck~& = 1 To blocks
Get filenum%, , block
_MemPut mem, mem.OFFSET + mpos~&&, block
mpos~&& = mpos~&& + BLOCKSIZE
Next blck~&
Close filenum%
'For c~&& = 0 To fsize - 1
' ch% = _MemGet(mem, mem.OFFSET + c~&&, _Unsigned _Byte)
' char~&&(ch%) = char~&&(ch%) + 1
'Next c~&&
$Checking:On
_MemFree mem
readBigFile~&& = fsize
End Function
45y and 2M lines of MBASIC>BASICA>QBASIC>QBX>QB64 experience