Hi
I found a macro where I can delete all files located in subfolders but for some reason this macro is not working. Attached is the image of the subfolders
What am I doing wrong? Thanks for your help.

End Sub
I found a macro where I can delete all files located in subfolders but for some reason this macro is not working. Attached is the image of the subfolders
Code:
Sub Clear_All_Files_And_SubFolders_In_Folder()
'Delete all files and subfolders
'Be sure that no file is open in the folder
Dim FSO As Object
Dim MyPath As String
Set FSO = CreateObject("scripting.filesystemobject")
MyPath = "S:\SPandA\Sales Operations\Workstreams\Logs\DirectConnect Summary Report\DC Team Member Logs" '<< Change
If Right(MyPath, 1) = "\" Then
MyPath = Left(MyPath, Len(MyPath) - 1)
End If
If FSO.FolderExists(MyPath) = False Then
MsgBox MyPath & " doesn't exist"
Exit Sub
End If
On Error Resume Next
'Delete files
FSO.deletefile MyPath & "\*.*", True
What am I doing wrong? Thanks for your help.
End Sub