Question[Help]Search File Function[Solved]

Posts 1–2 of 2 · Page 1 of 1
[Help]Search File Function[Solved]
How can you search for a file on the computer.
Can anyone give me the function. /
Code:
If file.exists("C:\abc.txt") then
msgbox("C:\abc.txt exists!!!")
end if
Code:
Dim CTBFilPth As String ' CTB Plot Style Files Path
CTBFilPth = "C:\Program Files\AutoCAD LT 2002\Plot Styles\"

So take this and play with it. It will search sub-folders too... When it
finds a CTB file, it adds it to a Combox (cmbCTB):

' Find Plot Styles in Multiple Folders and Lists them
' Get Folder Names Listing in Plot Styles Path
Dim rootDi As New DirectoryInfo(CTBFilPth)
Dim di As DirectoryInfo
For Each di In rootDi.GetDirectories
Dim CTBdirs() As String = Directory.GetFiles(CTBFilPth & di.Name)
For Each CTBfilname In CTBdirs
CTBtestname = System.IO.Path.GetFileName(CTBfilname)
' Test for CTB files and add to Combox 'cmbCTB'
Dim FilTest As String = CTBtestname.Remove(0, (Len(CTBtestname) - 3))
If UCase(FilTest) = "CTB" Then
cmbCTB.Items.Add(CTBtestname)
End If
Next
Next
Posts 1–2 of 2 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?