Click here to Skip to main content
15,926,035 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Map & disconnect drives Pin
Mike Dimmick26-Jan-04 3:16
Mike Dimmick26-Jan-04 3:16 
GeneralGet all directories and subdirectories Pin
ltt1925-Jan-04 13:18
ltt1925-Jan-04 13:18 
GeneralRe: Get all directories and subdirectories Pin
Colin Angus Mackay25-Jan-04 13:26
Colin Angus Mackay25-Jan-04 13:26 
GeneralRe: Get all directories and subdirectories Pin
ltt1925-Jan-04 13:41
ltt1925-Jan-04 13:41 
GeneralRe: Get all directories and subdirectories Pin
Colin Angus Mackay25-Jan-04 21:28
Colin Angus Mackay25-Jan-04 21:28 
GeneralRe: Get all directories and subdirectories Pin
ltt1926-Jan-04 4:05
ltt1926-Jan-04 4:05 
GeneralRe: Get all directories and subdirectories Pin
Colin Angus Mackay26-Jan-04 10:14
Colin Angus Mackay26-Jan-04 10:14 
GeneralRe: Get all directories and subdirectories Pin
-Dr_X-25-Jan-04 14:28
-Dr_X-25-Jan-04 14:28 
This code is for VB. VB.Net is quite similar though.

Set a reference to Microsoft Scripting Runtime
Dim srt As New Scripting.FileSystemObject
Dim drv As Drive
Dim fld As Folder
Dim f As File

  Set drv = srt.Drives("C:\")
  Set fld = drv.RootFolder
  For Each f In fld.Files
    Debug.Print f.Name
  Next

If you want to loop through each directory as well you will need to create another function to return the folder object. To check to see if a folder has sub folder use the following code: fld.SubFolders

Michael
GeneralRe: Get all directories and subdirectories Pin
ltt1926-Jan-04 4:08
ltt1926-Jan-04 4:08 
GeneralRe: Get all directories and subdirectories Pin
-Dr_X-26-Jan-04 4:34
-Dr_X-26-Jan-04 4:34 
GeneralRe: Get all directories and subdirectories Pin
ltt1926-Jan-04 5:32
ltt1926-Jan-04 5:32 
GeneralRe: Get all directories and subdirectories Pin
Jim Taylor25-Jan-04 23:21
Jim Taylor25-Jan-04 23:21 
GeneralRe: Get all directories and subdirectories Pin
ltt1926-Jan-04 4:11
ltt1926-Jan-04 4:11 
GeneralI got it! Pin
ltt1926-Jan-04 13:36
ltt1926-Jan-04 13:36 
GeneralThread Pin
Anonymous25-Jan-04 11:41
Anonymous25-Jan-04 11:41 
GeneralRe: Thread Pin
Anonymous25-Jan-04 11:42
Anonymous25-Jan-04 11:42 
GeneralRe: Thread Pin
Colin Angus Mackay25-Jan-04 13:34
Colin Angus Mackay25-Jan-04 13:34 
GeneralNewbie question Pin
Anonymous25-Jan-04 5:57
Anonymous25-Jan-04 5:57 
GeneralBackgroundimage of Treeview Pin
Member 84000225-Jan-04 2:12
Member 84000225-Jan-04 2:12 
Generalsetting register, associated file Pin
pnpfriend24-Jan-04 9:53
pnpfriend24-Jan-04 9:53 
GeneralStarting PowerPoint in a webbrowser control Pin
gregcost24-Jan-04 8:28
gregcost24-Jan-04 8:28 
GeneralChanging the color of a TabPage tab Pin
nvmoss24-Jan-04 3:09
nvmoss24-Jan-04 3:09 
GeneralRun an external application hidden Pin
gregcost23-Jan-04 7:03
gregcost23-Jan-04 7:03 
GeneralExcel feedback in VB6 Pin
clockit23-Jan-04 2:51
clockit23-Jan-04 2:51 
GeneralRe: Excel feedback in VB6 Pin
-Dr_X-24-Jan-04 13:27
-Dr_X-24-Jan-04 13:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.