|
-
Jan 25th, 2002, 11:55 PM
#1
Get Folder Names...
I need a sub to get all the folders in a dir. And do this:
VB Code:
Winsock1.SendData FolderName
FolderName = FolderName + !
DO you get what I mean?
Get a folder name, Send the name, Get the next name, Send it and so on until all the folder names have been sent??
-
Jan 26th, 2002, 12:13 AM
#2
-
Jan 26th, 2002, 12:38 AM
#3
Frenzied Member
VB Code:
Private Sub GetFolders(Folderspec as String)
Dim fso
dim folderobj
dim f
dim subfolder
dim foldername
set fso = CreateOhject("Scripting.FileSystemObject")
set folderobj = fso.GetFolder(Folderspec)
set subfolder = folderobj.SubFolders
For Each f in subfolders
foldername = f.Name
'do what you want'
Next
End Sub
When calling the sub pass it a folder path ("C:\", etc)
-
Jan 26th, 2002, 11:48 AM
#4
Type MisMatch and it highlights this:
This is how I called it:
and where you put
I changed that to
-
Jan 26th, 2002, 02:55 PM
#5
Hyperactive Member
Try this variation of John McKernan's Code
VB Code:
Private Sub GetFolders(Folderspec as String)
Dim fso
dim folderobj
dim f
dim root
dim foldername
set fso = CreateObject("Scripting.FileSystemObject")
set folderobj = fso.GetFolder(Folderspec)
set root = folderobj.Foldername ' Name or path not sure, no vb near me
For Each f.subfolders in root
foldername = f.Name
'do what you want'
Next
End Sub
I'm not on a vb-enabled box right now,, so do tell me if it works?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|