I have this code to show the empty sub folders, as is it shows the path and the folder name is there anyway to just show the folders name without the path?
Thanks
Code:
Sub ListEmptyFolders()
Dim fso As Object
Dim folder As Object
Dim subfolder As Object
Dim emptyFolders As String
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(Application.DefaultFilePath & "\" & "Music Copy")
For Each subfolder In folder.SubFolders
If subfolder.files.count = 0 And subfolder.SubFolders.count = 0 Then
emptyFolders = emptyFolders & subfolder.path & vbCrLf
End If
Next subfolder
If Len(emptyFolders) > 0 Then
MsgBox "The following folders are empty:" & vbCrLf & vbCrLf & emptyFolders
Else
MsgBox "No empty folders found."
End If
End Sub
Thanks