I would like to get a list of the files in a directory and rename them. I can count the number of files, I have done it with a single file, but now I have 2 files and need to rename (append a date stamp)to them than copy them to another directory.
Set FileObject = CreateObject("Scripting.FileSystemObject"
Set SourceFolder = FileObject.GetFolder("C:\DATA\FTP\ARI\"
Set TargetFolder = FileObject.GetFolder("C:\DATA\FTP\ARI\ARCHIVE"
Set FileCollection = SourceFolder.Files
'Get the list of files
For Each File in FileCollection
File.name = Mid(File.name, 1) + "datestamp"
Next
-- the above renames them just fine .. BUT move or copy them is different ..
For Each File in FileCollection
FileObject.MoveFile SourceFolder & File.name, TargetFolder
Next
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.