This is a basic directory and file lister I created about 10 years back. I though I would paste the code here incase others could improve on it.
vb Code:
'You need: '1 Drive List Box called Drive1 '1 Directory List Box called Dir1 '1 File lisrt box called File1 '1 Combo box called cmbType '2 Command Buttons Dim n As Integer Private Sub CmbType_Click() On Error GoTo err: File1.Pattern = CmbType.Text Exit Sub err: MsgBox ("Please select a file type!") End Sub Private Sub Command1_Click() 'Close the program Unload Me End Sub 'Directory and File Lister 'Version 1.0 'Author: Nightwalker83 'Website: http://aaronspehr.net/ Private Sub Command2_Click() 'Save list to a text file. For n = 1 To File1.ListCount Open App.Path & "\Files.txt" For Append As #1 Print #1, File1.List(n) Close #1 Next n End Sub Private Sub Dir1_Change() File1.Path = Dir1.Path End Sub Private Sub Drive1_Change() On Error GoTo err: Dir1.Path = Drive1.Drive Exit Sub err: MsgBox ("Please choose another drive!") End Sub Private Sub Form_Load() frmDFL.Caption = "Directory and File Lister" Command1.Caption = "Exit" Command2.Caption = "Save" CmbType.Text = "File Type:" 'Library Files. CmbType.AddItem "*.dll" 'Word Documents. CmbType.AddItem "*.doc" 'Executables. CmbType.AddItem "*.exe" 'Text Files. CmbType.AddItem "*.txt" 'All Files. CmbType.AddItem "*.*" End Sub
Nightwalker



Reply With Quote