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)
 DTS packages

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-12-11 : 09:44:44
Roger writes "Is it possible to delete a text file with a DTS package? The text file is downloaded daily and we want to make sure it is a new file every day?"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2001-12-11 : 12:17:42
You can add an ActiveX task to your package to do this. The code would look like this:

Set fso=CreateObject("Scripting.FileSystemObject")
fso.DeleteFile("C:\myPath\myFile.txt")
set fso=Nothing


Put this into the Function Main() declaration, do not remove any of the extra code that is put in by default.

MSDN has documentation on the FileSystemObject object class and all its methods, you should definitely read up on it before using this code, as I'm not sure if an error will occur if the file can't be found.

Go to Top of Page
   

- Advertisement -