I want to search hidden files and hidden Folders one by one of (c:\myFolder\), Then i want to make a list.
How to do it?
Printable View
I want to search hidden files and hidden Folders one by one of (c:\myFolder\), Then i want to make a list.
How to do it?
As this is not database related, I have moved it from the Database Development forum.
Duplicate threads deleted
I just wrote a function that loops through directories and then puts all the file names in a collection.
This should work for you.
Nice! Just what I find.
Thank you numtel
One thing - How can I get the Last Folder name in the path?
I mean,
In the path
___________myPath = "C:\new folder\pro\"
I want to get
___________myFolder = "pro"
Try thisCode:Private Sub Command1_Click()
Dim MyPath As String
Dim arrFolder() As String
MyPath = "C:\new folder\pro"
arrFolder = Split(MyPath, "\")
MsgBox arrFolder(UBound(arrFolder))
End Sub
edit: looks like hack beat me, but i am not sure if you will get an empty array element thanks to your trailing slash, so my code went ahead and assumed you did.Code:dim pathparts() as string
pathparts = split(mypath, "\")
if pathparts(ubound(pathparts)) <> "" then
msgbox pathparts(ubound(pathparts))
else
msgbox pathparts(ubound(pathparts)-1)
end if
thank you Hack
thank you Lord Orwell