Click to See Complete Forum and Search --> : Retrieve file list from cd


Javier otero
January 19th, 2000, 06:01 PM
how can i get the list of all the files in a cd.I would like to store the information of every cd in a file.

JimmyT
January 19th, 2000, 08:26 PM
Try this:

This code is designed to allow you to select any drive and directory and will copy entries from a FileListBox into a standard ListBox. (You can use similar techniques to copy the list of files from the FileListBox into any other receptacle, including text files, databases, etc...)

1) Start a new project (Standard .exe)
2) Add a DriveListBox, a DirectoryListBox, and a FileListBox to Form1. Add a Command Button to your form. Add a ListBox Control to your form.

3) Insert the following code into Form1:

option Explicit

private Sub Command1_Click()
Dim myIndex as Integer
With List1
Do While myIndex < File1.ListCount
.AddItem File1.List(myIndex)
myIndex = myIndex + 1
Loop
End With
End Sub

private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub

private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub





4) run the project and select the drive identity for your CD Rom (usually D:) and then select any directory name that may exist on the CD. Your list of files in that directory will appear in the FileListBox. You can copy the names of the files into the ListBox by clicking on the Command Button.

Good Luck