Page 1 of 1

move through hdd files one at a time

Posted: Tue Jul 08, 2014 2:45 am
by Mr.Wilson
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.
Code: Select all
    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
Thanks in advance

Re: move through hdd files one at a time

Posted: Tue Jul 08, 2014 5:50 am
by CodenStuff
Do you know my heads not in VB mode right now, completely forgotten how to do directory searches :lol:

Until someone else replies, this may help you. It contains source code for a search application using threads which you will want to use so the application doesn't lock up.

viewtopic.php?f=32&t=8350&p=61766

Re: move through hdd files one at a time

Posted: Tue Jul 08, 2014 6:04 am
by smashapps
I was going to give you some source code but I can only search entire c drive, rather than picking a drive to search from. If I come up with something later I'll let you know.

For now I guess your best friend is Google