var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Renaming files with DTS using ActiveX script task
I have a DTS package that I want to use to copy a file from one directory to another, and then rename it. I'm doing this using a VB script within an ActiveX script task.
The problem is I don't know exactly what the name of the file I need to copy will be. I do know it will be of the format t****1p**.xml
I can copy all files of a particular file name format to another directory using this code within the script:
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.copyfile "c:\test\t*1p*.xml", "c:\results\"
Main = DTSTaskExecResult_Success
The problem here is that the file is copied with it's original file name, which is no good to me. If I try to specify the file name to copy to, ie:
FSO.copyfile "c:\test\t*1p*.xml", "c:\results\data.xml"
...it complains about an invalid path when I run the script.
I've also tried this:
Set FILE = FSO.GetFile("c:\test\t*p*.xml")
FILE.name = "data.xml"
But it won't let me reference the file without specifying it's exact file name.
Any help greatly appreciated!
Ta in advance,
I'm guessing, but I think you want to enumerate the source files using the Files object, then copy them one at a time (renaming as you go) using the CopyFile method.
Thanks Pat that's done the trick!