'引用FSO("工程"->"引用"->Microsoft Scripting Runtime)Private Sub Command1_Click() SearchFolder "d:\test\" '假设你的图片放在D:\test\文件夹下 End SubSub SearchFolder(ByVal Folder As String) Dim fso As New FileSystemObject Dim objFile As File, objFolder As Folder
Set objFolder = fso.GetFolder(Folder) For Each objFile In objFolder.Files reNameFile objFile.Path Next End SubSub reNameFile(ByVal fullName As String) Dim newName As String, pos As Integer pos = InStrRev(fullName, "\") newName = Mid(fullName, 1, pos) & Replace(Mid(fullName, pos + 1), "_调整图片", "") Name fullName As newName End Sub
SearchFolder "d:\test\" '假设你的图片放在D:\test\文件夹下
End SubSub SearchFolder(ByVal Folder As String)
Dim fso As New FileSystemObject
Dim objFile As File, objFolder As Folder
Set objFolder = fso.GetFolder(Folder)
For Each objFile In objFolder.Files
reNameFile objFile.Path
Next
End SubSub reNameFile(ByVal fullName As String)
Dim newName As String, pos As Integer
pos = InStrRev(fullName, "\")
newName = Mid(fullName, 1, pos) & Replace(Mid(fullName, pos + 1), "_调整图片", "")
Name fullName As newName
End Sub