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.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Delete blank files via DTS

Author  Topic 

mitchel
Starting Member

11 Posts

Posted - 2005-08-31 : 13:33:13
Hi,

The following code works perfectly but now I want to do a little tweak at a
different part of the DTS package. What I want to do is to delete files that
are blank so they are not FTP'd to the remote server (a zero byte TXT file).
I can see in my head what I need to do to the code, but I cannot figure it
out. It seems like I would have to add some type of IF statement?

This is the code that runs after the FTP part so the files do not get sent
again:

'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************

Function Main()

Dim objFSO
Dim objFolder
Dim objFile

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\Websites\LocalUser\web-forms\aio\")

For Each objFile In objFolder.Files
objFile.Delete True
Next

Set objFile = Nothing
Set objFolder = Nothing
Set objFSO = Nothing

Main = DTSTaskExecResult_Success
End Function



Any help would be greatly appreciated.

Thanks!

Mitch

   

- Advertisement -