rule of flename
Sub-folders's Name & space & date & ,extension
Option Explicit
Sub test4()
Dim srcFld As String, dstFld As String, subFld As String, myFile As String
Dim fso As Object, f As Object
Dim n As Long
With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = "C:\*****\*****"
.Title = "select source folder"
If .Show Then
srcFld = .SelectedItems.Item(1)
Else
Exit Sub
End If
End With
With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = "D:"
.Title = "select destination folder"
If .Show Then
dstFld = .SelectedItems.Item(1)
Else
Exit Sub
End If
End With
Set fso = CreateObject("Scripting.FileSystemObject")
For Each f In fso.GetFolder(srcFld).Files
myFile = f.Name
n = InStrRev(myFile, " ") - 1
If n > 1 Then
subFld = dstFld & "\" & Mid(myFile, 1, n)
If fso.FolderExists(subFld) Then
f.Move subFld & "\"
End If
End If
Next
End Sub