Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Donovan
Starting Member
8 Posts |
Posted - 2004-05-12 : 15:12:02
|
| I have a file that gets placed on our ftp site once a week. The file is named achconxx.datThe xx is the fiscal week meaning the file one week looks like achcons18.dat and the next week it will look like achcons19.datI am trying use an ActiveX script in my DTS package to move and unzip that file and rename to achcons.dat so I can import.My code looks like this so far:Function Main()Dim objWshshell, objFsoDim strCmd, strSubject, strMessage, strFileattachment, rcDTSGlobalVariables("gv_strWklydir").value = "\\E$\Update\Data\" ' Weekly directoryDTSGlobalVariables("gv_strACHFile").value = "achcon" & DTSGlobalVariables("gv_strFW").value & ".zip" ' ACH Group weekly fileSet objFso = CreateObject("Scripting.FileSystemObject")Set objWshshell = CreateObject("WScript.Shell")rc = 0' Build the Winzip commandIf (objFso.FileExists(DTSGlobalVariables("gv_strWklydir").value & DTSGlobalVariables("gv_strACHFile").value)) ThenstrCmd = "winzip32.exe -e -o " & DTSGlobalVariables("gv_strWklydir").value &_DTSGlobalVariables("gv_strACHFile") & " " & DTSGlobalVariables("gv_strWklydir").valuerc = objWshshell.Run(strCmd, 1, true)' Rename fileIf (objFso.FileExists(DTSGlobalVariables("gv_strWklydir").value & objFso.GetBaseName(DTSGlobalVariables("gv_strACHFile")) & ".dat")) ThenobjFso.GetFile(DTSGlobalVariables("gv_strWklydir").value & objFso.GetBaseName(DTSGlobalVariables("gv_strACHFile")) & ".dat").Copy (DTSGlobalVariables("gv_strWklydir").value & "achcon.dat")End IfSet objWshshell = NothingSet objFso = NothingEnd IfI think my concatenation is missing something due to to "gv_strFW" being numeric. I also have an e-mail routine that sends me an e-mail if the file doesn't exist. The e-mail works so my routine can't see the file it needs to move/unzip and rename.Any help is appreciated. |
|
|
|
|
|