move through hdd files one at a time
Posted: Tue Jul 08, 2014 2:45 am
Hi all, I am trying to cycle through the directories, sub directories and files on a hard drive one at a time
and list them in a label just as an antivirus program might. I can list the contents of "My Documents" folder or some unprotected random folder of choosing but run into security when trying "C:\" or even "C:\ Documents and Settings". Clarify: I want to be able to select the drive of choice from those available on the machine press a button and have the program to cycle through each directorie, sub directory and file on the hard drive listing each in a label one at a time. here is what I have so far.
and list them in a label just as an antivirus program might. I can list the contents of "My Documents" folder or some unprotected random folder of choosing but run into security when trying "C:\" or even "C:\ Documents and Settings". Clarify: I want to be able to select the drive of choice from those available on the machine press a button and have the program to cycle through each directorie, sub directory and file on the hard drive listing each in a label one at a time. here is what I have so far.
Code: Select all
Thanks in advance Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
ComboBox1.Items.AddRange(System.IO.Directory.GetLogicalDrives)
For Each foundFile As String In My.Computer.FileSystem.GetFiles(
My.Computer.FileSystem.SpecialDirectories.MyDocuments)
ListBox1.Items.Add(foundFile)
Next
End Sub