Sub copyfileinSameFolder()
Set fs = CreateObject("Scripting.FileSystemObject")
oldpath = "D:\test"
newPath = "D:\test"
Prefix = "1_"
Set f = fs.getfolder(oldpath)
Set NFile = f.Files
For Each pf1 In NFile
NameFile = pf1.Name
filecopy oldpath & "\" & NameFile, newPath & "\" & Prefix & NameFile
Next
End Sub
Code:Sub copyfileinSameFolder() Set fs = CreateObject("Scripting.FileSystemObject") oldpath = "D:\test" newPath = "D:\test" Prefix = "1_" Set f = fs.getfolder(oldpath) Set NFile = f.Files For Each pf1 In NFile NameFile = pf1.Name filecopy oldpath & "\" & NameFile, newPath & "\" & Prefix & NameFile Next End Sub
Code:Sub copyfileinSameFolder() Set fs = CreateObject("Scripting.FileSystemObject") oldpath = "D:\test" newPath = "D:\test" Prefix = "1_" Set f = fs.getfolder(oldpath) Set NFile = f.Files For Each pf1 In NFile NameFile = pf1.Name filecopy oldpath & "\" & NameFile, newPath & "\" & Prefix & NameFile Next End Sub