Help to rename files

H

Hilton

Is there a way I can rename files:

AFT.11.DAT
AFT.12.DAT
AFT.21.DAT
AFT.22.DAT
(not the 2 "dots")

to

SEG11.DAT
SEG12.DAT
SEG21.DAT
SEG22.DAT

Thanks
Hilton
 
B

Bob Phillips

Why don't you just change the names? What is the issue here?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
D

Don Guillett

Modify this to rename instead of move. Something like this. TEST
oldname = "C:\x\" & FN
newname = "C:\y\" & "Sig"& right(FN,len(fn)-3)



Sub Movefiles()

Application.ScreenUpdating = False
Dim FN As String
FileLocation = "c:\x\*.xls"
FN = Dir(FileLocation)
Do Until FN = ""

If Mid(FN, 4, 1) = "_" Then
oldname = "C:\x\" & FN
newname = "C:\y\" & FN
Name oldname As newname
End If
FN = Dir
Loop
Application.ScreenUpdating = True
End Sub
 
Top