Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using a wildcard in an activeX script task to copy files

Status
Not open for further replies.

DanC

Programmer
Jan 12, 2001
65
US
I'm trying to take a file that has a name of agtpacxxxxxx.txt where 'xxxxxx' can be almost anything, and copy it to a new file called agent.txt. I keep getting a path not found error when trying to use the following script:

Function Main()
Dim fso, sourceFile, destFile

Set fso = CreateObject("Scripting.FileSystemObject")
sourceFile = "C:\projects\dsc\source\agtpac*.txt"
destFile = "C:\projects\dsc\source\agent.txt"
fso.CopyFile sourceFile,destFile,true

Set fso = Nothing
Main = DTSTaskExecResult_Success
End Function

Can anyone help me out?

thanks

-D
 
Could you use an "Execute SQL Task" with the following code ...


EXEC master..cmdshell 'REN C:\projects\dsc\source\agtpac*.txt C:\projects\dsc\source\agent.txt'



Thanks

J. Kusch
 
I know what it is: You can not copy multiple files to a single file. That's what dts thinks you are trying to do.

Why not use fso to do a dir on the folder and take the first file it finds? Or at least return a good filename to the copy command.

I hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top