Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
My bad, sorry. I usually pay attention to the VFP forum and those are visual foxpro functions.VB6 (for that is what this forum is about) does not have adir, filetostr or strtofile functions
' Requires reference to Microsoft Scripting Runtime
Public Sub CombineTextFilesFSO()
Dim fso As FileSystemObject
Dim srcFile As File
Dim dstFile As TextStream
Dim sourceFolder As String
Dim destinationFile As String
' Define the source folder and the destination file
sourceFolder = "D:\Downloads\DeleteMe\Source\" ' Change to your folder
destinationFile = "D:\Downloads\DeleteMe\Source\Combined.txt" ' Change to your output file
With New FileSystemObject
Set dstFile = .OpenTextFile(destinationFile, ForAppending, True)
For Each srcFile In .GetFolder(sourceFolder).Files
If .GetExtensionName(srcFile) = "txt" And srcFile.Path <> destinationFile Then
dstFile.Write srcFile.OpenAsTextStream.ReadAll
End If
Next
End With
End Sub
# Merge all .TXT files in a directory into one file
# Define the directory to search for TXT files
$directory = "C:\Mixed content"
# Define the output file
$outputFile = Join-Path -Path $directory -ChildPath "combined.txt"
# Get all TXT files in the directory (excluding subdirectories)
$txtFiles = Get-ChildItem -Path $directory -Filter *.txt -File
# Initialize the output file by removing any existing file with the same name
if (Test-Path -Path $outputFile) {
Remove-Item -Path $outputFile
}
foreach ($file in $txtFiles) {
# Append the content of each file to the combined.txt
Get-Content -Path $file.FullName | Add-Content -Path $outputFile
}
Private Sub MergeIt(ByVal sPath As String)
Dim sFile As String
Dim bText() As Byte
sFile = Dir(sPath & "*.txt")
Open "textFile.txt" For Binary Access Write As #1
Do While Len(sFile) > 0 '
bText = sLoadFile(sPath & sFile) 'encoding is not matter
Put #1, , bText
sFile = Dir 'find next
DoEvents
Loop
Close #1
End Sub
Private Function sLoadFile(sFile As String) As String
Dim iFree As Integer
Dim bRead() As Byte
iFree = FreeFile()
Open sFile For Binary As iFree
ReDim bRead(LOF(iFree))
Get iFree, , bRead
Close iFree
sLoadFile = bRead
End Function