改成
If FileSys.DirectoryExists( path & dr("客户姓名")) Then
For Each File As String In FileSys.GetFiles( path & dr("客户姓名"))
Dim name() As String = FileSys.GetName(file).split("-")
If name.length > 1
FileSys.CopyFile(file, ProjectPath & "复制到文件夹/" & zpxghmc & name(1), True)
If FileSys.FileExists(path & dr("客户姓名") & "\" & zpxghmc & name(1)) = False Then
If r IsNot Nothing Then
FileSys.RenameFile(file, zpxghmc & name(1))
End If
End If
End If
Next
Else
MessageBox.Show("要修改的文件夹不存在!", "提示")
Return
End If