Michael Clease
28-05-2007, 10:14
' Usage of the JOIN$ Keyword
'
' Written by Abraxas
USES "UI"
USES "FILE"
DIM SelectedDIR AS STRING ' The directory that we want to scan
Dim TheFileList() As String ' The Filename Table
DIM FileLength() as DWORD ' The File Length Table
Dim NumberofFiles As DWORD ' The Number of files in the list
DIM n as LONG ' Loop Variable
dim sMsg as string ' Message String
SelectedDIR = Dialog_BrowseForFolder(0, "Please select a directory", "C:\", %FALSE)
NumberofFiles = DIR_ListArray(TheFileList, SelectedDIR, "*.*", %FILE_NORMAL or %FILE_ADDPATH)
'MsgBox 0, "Directory "+SelectedDIR+$CRLF+$CRLF+"FileList "+TheFilelist(1)+$CRLF+$CRLF+"Number of files "+NumberofFiles
' Fill File Length Table
redim FileLength(NumberofFiles) ' Allocate space for File Length Table
for n = 1 to NumberofFiles
FileLength(n) = File_Size (TheFileList(n)) ' MSGBOX 0, n+" "+TheFileList(n)+" "+FileLength(n)
next
sMsg = "Number of files found: " & NumberofFiles & $crlf & $crlf
sMsg += "First 10 files are:" & $crlf & $CRLF
sMsg += JOIN$(TheFileList, $crlf, "", 1, 10) ' add only 10 files to list
msgbox 0, sMsg
'
' Written by Abraxas
USES "UI"
USES "FILE"
DIM SelectedDIR AS STRING ' The directory that we want to scan
Dim TheFileList() As String ' The Filename Table
DIM FileLength() as DWORD ' The File Length Table
Dim NumberofFiles As DWORD ' The Number of files in the list
DIM n as LONG ' Loop Variable
dim sMsg as string ' Message String
SelectedDIR = Dialog_BrowseForFolder(0, "Please select a directory", "C:\", %FALSE)
NumberofFiles = DIR_ListArray(TheFileList, SelectedDIR, "*.*", %FILE_NORMAL or %FILE_ADDPATH)
'MsgBox 0, "Directory "+SelectedDIR+$CRLF+$CRLF+"FileList "+TheFilelist(1)+$CRLF+$CRLF+"Number of files "+NumberofFiles
' Fill File Length Table
redim FileLength(NumberofFiles) ' Allocate space for File Length Table
for n = 1 to NumberofFiles
FileLength(n) = File_Size (TheFileList(n)) ' MSGBOX 0, n+" "+TheFileList(n)+" "+FileLength(n)
next
sMsg = "Number of files found: " & NumberofFiles & $crlf & $crlf
sMsg += "First 10 files are:" & $crlf & $CRLF
sMsg += JOIN$(TheFileList, $crlf, "", 1, 10) ' add only 10 files to list
msgbox 0, sMsg