move through hdd files one at a time

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
3 posts Page 1 of 1
Contributors
User avatar
Mr.Wilson
New Member
New Member
Posts: 24
Joined: Sat Apr 23, 2011 3:42 pm

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
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

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
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
smashapps
Coding Guru
Coding Guru
Posts: 961
Joined: Tue Apr 05, 2011 8:41 am

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
My name is Tom | Visit my blog where I post new content every day! Tom's Daily Blog | MineCraft is awesome!
3 posts Page 1 of 1
Return to “Coding Help & Support”