Results 1 to 8 of 8
  1. #1
    Bombsaway707's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    Gym
    Posts
    8,799
    Reputation
    791
    Thanks
    4,004
    My Mood
    Amused

    How to find subfolders within a folder

    Alright guys so im making an anti cheat program which scans files md5 signature and if contains a hacks md5 signature then it reports it to the leader but anyway i just want to know how find the names of a sub folder within a folder. Ex: i have a folder at C:\hi and that folder has a sub folder within it named "bye" how would i find this via VB?
    Thanks, Bombs.

  2. #2
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,198
    Reputation
    205
    Thanks
    1,445
    My Mood
    Mellow
    Directory.GetDirectories Method (String) (System.IO)

    Recursive calling would be a good idea to get to the very end of all folders, if there are that many.

  3. #3
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    Here we go. Correct any errors as necessary. Just wrote it on MPGH post reply, so yeahs. C# and Visual Basic versions provided.

    You will need to put your MD5 hashes which you want to check against in an array, either hard coded or loaded from a file or from a website or however you want into a string[] called "MD5Hashes". You can change the variable names if you wish.


    Code:
    Private Sub DirSearch(sDir As String)
    	For Each d As String In Directory.GetDirectories(sDir)
    		Console.WriteLine(d)
    		DirSearch(d)
    	Next
    End Sub
    
    Private Function main() As Integer
    	DirSearch("C:\freedompeace")
    End Function
    Last edited by Lolland; 11-29-2010 at 11:11 PM.

  4. #4
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,198
    Reputation
    205
    Thanks
    1,445
    My Mood
    Mellow
    Naw mang you didn't just write that in post reply, it looks too close to this, function/variable names and all.

    How to recursively search directories by using Visual C#

  5. The Following 5 Users Say Thank You to Void For This Useful Post:

    'Bruno (11-29-2010),Blubb1337 (11-29-2010),Hassan (11-29-2010),Lolland (11-29-2010),[MPGH]master131 (11-29-2010)

  6. #5
    'Bruno's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Portugal
    Posts
    2,883
    Reputation
    290
    Thanks
    1,036
    My Mood
    Busy
    Quote Originally Posted by Void View Post
    Naw mang you didn't just write that in post reply, it looks too close to this, function/variable names and all.

    How to recursively search directories by using Visual C#
    ye man.. Microsoft leeched freedom...
    Light travels faster than sound. That's why most people seem bright until you hear them speak.

  7. #6
    Hassan's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    System.Threading.Tasks
    Posts
    4,764
    Reputation
    495
    Thanks
    2,133
    My Mood
    Dead
    Quote Originally Posted by Void View Post
    Naw mang you didn't just write that in post reply, it looks too close to this, function/variable names and all.

    How to recursively search directories by using Visual C#
    Remember what I told you on MSN ? :P

  8. #7
    Lolland's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Location
    Lolland!
    Posts
    3,156
    Reputation
    49
    Thanks
    868
    My Mood
    Inspired
    Please remember to give credits

  9. The Following User Says Thank You to Lolland For This Useful Post:

    NextGen1 (11-29-2010)

  10. #8
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    on top of that, C# stays in C#