Code:
Dim FSO As New FileSystemObject
Private Sub Command1_Click()
Dim fld As Folder
Dim flds As Folders
Dim fl As File
With FSO
Set fld = .GetFolder("D:\Projects Others\TZ-HASAN\WEB\images_upload")
Dim f
'MsgBox fld.Files.Count
For Each fl In fld.Files
If Right(fl.Name, 3) = "img" Then
fl.Name = Left(fl.Name, Len(fl.Name) - 3) & "gif"
End If
Next
End With
End Sub