D
dibblm
Below is current code used. I can only list one directory then move to next.
I want to search one more directory further and can't seem to find how to
get one deeper. What I want to accomplish is to get to a specified
directory, Then list all the files of that directory. Move to the next and
do the same.
J:\
-user1
--Cookies
---List all files
--Cookies
---List all files
MyPath = "J:\" ' Set the path.
MySubdir = Dir("\" & "Cookies")
MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry.
MyName = Dir(MyPath, vbDirectory)
Do While MyName <> "" ' Start the loop.
' Use bitwise comparison to make sure MyName is a directory.
If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
' Display entry only if it's a directory.
Debug.WriteLine(MyName, MySubdir)
End If
MyName = Dir() ' Get next entry.
I want to search one more directory further and can't seem to find how to
get one deeper. What I want to accomplish is to get to a specified
directory, Then list all the files of that directory. Move to the next and
do the same.
J:\
-user1
--Cookies
---List all files
- user2move to next user
--Cookies
---List all files
Dim MyFile, MyPath, MyName, MySubdir, mysubmove to next user
MyPath = "J:\" ' Set the path.
MySubdir = Dir("\" & "Cookies")
MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry.
MyName = Dir(MyPath, vbDirectory)
Do While MyName <> "" ' Start the loop.
' Use bitwise comparison to make sure MyName is a directory.
If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
' Display entry only if it's a directory.
Debug.WriteLine(MyName, MySubdir)
End If
MyName = Dir() ' Get next entry.