Use the example for the Dir command: (modified to perform what your code
does)
' Display the names in H:\JAZZ that represent directories.
MyPath = "H:\JAZZ" ' Set the path.
MyName = Dir(MyPath, vbDirectory) ' Retrieve the first entry.
i = 0
Do While MyName < "" ' Start the loop.
' Ignore the current directory and the encompassing directory.
If MyName < "." And MyName < ".." Then
' Use bitwise comparison to make sure MyName is a directory.
If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
i = i + 1
cells(i,1).Value = MyName ' Display entry only if it
End If ' it represents a directory.
End If
MyName = Dir ' Get next entry.
Loop
Assumes you only want first level directories.
What do you mean by size - in kb sum of all the file sizes?
--
Regards,
Tom Ogilvy
GEORGEBEKOS wrote in message
...
I USE THIS
Sub IndexFiles()
With Application.FileSearch
LookIn = "H:\JAZZ"
FileType = msoFileTypeAllFiles
SearchSubFolders = True
Execute
End With
cnt = Application.FileSearch.FoundFiles.Count
For i = 1 To cnt
Rng = "A" & i
Range(Rng).Value = Application.FileSearch.FoundFiles.Item(i)
Next i
End Sub
AND I GET THIS RESULTS
H:\JAZZ\ANTHONY BRAXTON - Seven standards 1985\01 - Joy
Spring.mp3
H:\JAZZ\ANTHONY BRAXTON - Seven standards 1985\02 - Spring Is
Here.mp3
H:\JAZZ\ANTHONY BRAXTON - Seven standards 1985\03 - I Remember
You.mp3
H:\JAZZ\ANTHONY BRAXTON - Seven standards 1985\04 - Touch To My
Head.mp3
H:\JAZZ\ARNETT COBB - Go power go power\01 - When I Grow Too Old To
Dream.mp3
H:\JAZZ\ARNETT COBB - Go power go power\02 - Go Power.mp3
H:\JAZZ\ARNETT COBB - Go power go power\03 - Dutch Kitchen
Bounce.mp3
H:\JAZZ\ARNETT COBB - Go power go power\04 - Go Red, Go.mp3
THIS IS A PART ONLY
AS YOU SEE I TAKE ALL THE SONG FROM FOLDER ,BUT I WANT ONLY FOLDER NAME
(AND SIZE IF POSSIBLE)
------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/