G
GEORGEBEKOS
IWANT SOME HELP
I WANT TO GET THE SIZE OF A FOLDER THAT CONTAINS (.M3U)
(.M3U IS A PLAYLIST FROM WINAMP)
THE FOLDER THAT HAS .M3U CONTAINS MP3 FILES AND IF IN THE FOLDER
HAVE A .M3U I WANT THE SIZE OF THE FOLDER (THE SUMMARY OF MP3 THA
EXIST IN THIS FOLDER)
i will give you an example so i can be more specific
this is what i get from the code
H:\JAZZ\Dizzy Gillespie\Dizzy Gillepsie - Cuban Jazz Moods\(Dizz
Gillespie) Afro Cuban Jazz Moods.m3u
H:\JAZZ\Miles Davis\Miles Davis - Blue Moods\(Miles Davis) Blu
Moods.m3u
...................................................................................................
and more
i now want to have this look
H:\JAZZ\Dizzy Gillespie\Dizzy Gillepsie - Cuban Jazz Moods\(Dizz
Gillespie) Afro Cuban Jazz Moods.m3u\ 26.800 kb or 26.8 mb
H:\JAZZ\Miles Davis\Miles Davis - Blue Moods\(Miles Davis) Blu
Moods.m3u\ 67.000 kb or 67 mb
the kbs or mb should be the summary of of all files in the folder
that contain the .m3u file
I USE THIS
Private Type BROWSEINFO ' used by the function GetFolderName
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _
ByVal pszPath As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32.dll" _
Alias "SHBrowseForFolderA" (lpBrowseInfo _
As BROWSEINFO) As Long
Function GetFolderName(Msg As String) As String
' returns the name of the folder selected by the user
Dim bInfo As BROWSEINFO, path As String, r As Long
Dim X As Long, pos As Integer
bInfo.pidlRoot = 0& ' Root folder = Desktop
If IsMissing(Msg) Then
bInfo.lpszTitle = "Select a folder."
' the dialog title
Else
bInfo.lpszTitle = Msg ' the dialog title
End If
bInfo.ulFlags = &H1 ' Type of directory to return
X = SHBrowseForFolder(bInfo) ' display the dialog
' Parse the result
path = Space$(512)
r = SHGetPathFromIDList(ByVal X, ByVal path)
If r Then
pos = InStr(path, Chr$(0))
GetFolderName = Left(path, pos - 1)
Else
GetFolderName = ""
End If
End Function
Sub TestGetFolderName()
Dim FolderName As String
FolderName = GetFolderName("Select a folder")
If FolderName = "" Then
MsgBox "You didn't select a folder."
Else
With Application.FileSearch
.NewSearch
.LookIn = FolderName
.SearchSubFolders = True
.FileName = ".m3u"
.FileType = msoFileTypeAllFiles
If .Execute() > 0 Then
cnt = .FoundFiles.Count
For i = 1 To cnt
Rng = "A" & i
Range(Rng).Value = Application. _
FileSearch.FoundFiles.Item(i)
Next i
Else
MsgBox "There were no files found."
End If
End With
End If
End Su
I WANT TO GET THE SIZE OF A FOLDER THAT CONTAINS (.M3U)
(.M3U IS A PLAYLIST FROM WINAMP)
THE FOLDER THAT HAS .M3U CONTAINS MP3 FILES AND IF IN THE FOLDER
HAVE A .M3U I WANT THE SIZE OF THE FOLDER (THE SUMMARY OF MP3 THA
EXIST IN THIS FOLDER)
i will give you an example so i can be more specific
this is what i get from the code
H:\JAZZ\Dizzy Gillespie\Dizzy Gillepsie - Cuban Jazz Moods\(Dizz
Gillespie) Afro Cuban Jazz Moods.m3u
H:\JAZZ\Miles Davis\Miles Davis - Blue Moods\(Miles Davis) Blu
Moods.m3u
...................................................................................................
and more
i now want to have this look
H:\JAZZ\Dizzy Gillespie\Dizzy Gillepsie - Cuban Jazz Moods\(Dizz
Gillespie) Afro Cuban Jazz Moods.m3u\ 26.800 kb or 26.8 mb
H:\JAZZ\Miles Davis\Miles Davis - Blue Moods\(Miles Davis) Blu
Moods.m3u\ 67.000 kb or 67 mb
the kbs or mb should be the summary of of all files in the folder
that contain the .m3u file
I USE THIS
Private Type BROWSEINFO ' used by the function GetFolderName
hOwner As Long
pidlRoot As Long
pszDisplayName As String
lpszTitle As String
ulFlags As Long
lpfn As Long
lParam As Long
iImage As Long
End Type
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" _
Alias "SHGetPathFromIDListA" (ByVal pidl As Long, _
ByVal pszPath As String) As Long
Private Declare Function SHBrowseForFolder Lib "shell32.dll" _
Alias "SHBrowseForFolderA" (lpBrowseInfo _
As BROWSEINFO) As Long
Function GetFolderName(Msg As String) As String
' returns the name of the folder selected by the user
Dim bInfo As BROWSEINFO, path As String, r As Long
Dim X As Long, pos As Integer
bInfo.pidlRoot = 0& ' Root folder = Desktop
If IsMissing(Msg) Then
bInfo.lpszTitle = "Select a folder."
' the dialog title
Else
bInfo.lpszTitle = Msg ' the dialog title
End If
bInfo.ulFlags = &H1 ' Type of directory to return
X = SHBrowseForFolder(bInfo) ' display the dialog
' Parse the result
path = Space$(512)
r = SHGetPathFromIDList(ByVal X, ByVal path)
If r Then
pos = InStr(path, Chr$(0))
GetFolderName = Left(path, pos - 1)
Else
GetFolderName = ""
End If
End Function
Sub TestGetFolderName()
Dim FolderName As String
FolderName = GetFolderName("Select a folder")
If FolderName = "" Then
MsgBox "You didn't select a folder."
Else
With Application.FileSearch
.NewSearch
.LookIn = FolderName
.SearchSubFolders = True
.FileName = ".m3u"
.FileType = msoFileTypeAllFiles
If .Execute() > 0 Then
cnt = .FoundFiles.Count
For i = 1 To cnt
Rng = "A" & i
Range(Rng).Value = Application. _
FileSearch.FoundFiles.Item(i)
Next i
Else
MsgBox "There were no files found."
End If
End With
End If
End Su