Results 1 to 10 of 10

Thread: Win32 executable in DTS

  1. #1
    Join Date
    Oct 2005
    Posts
    17

    Question Win32 executable in DTS

    How can I delete a txt file using the "Execute Process Task" in a DTS package?

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    create a batch file C:\Delfile.bat with the following code

    DEL/Q %1

    In the execute process task under win32 process type

    C:\delfile.bat

    under the parameter type filename example
    c:\test.txt

    when executed in the design mode it deletes the file from your machine. If you are scheduling create that batch file on the SQL Server box.

    You can do all these with a simple ActiveXScript.

  3. #3
    Join Date
    Oct 2005
    Posts
    17

    Thumbs down

    TXS MAK for the prompt reply!!!

    Of course, it would be better to use an simple ActiveXScript in the same DTS package, but I have no clue at all how to do it.

  4. #4
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    Save this as deletefile.vbs and to delete a file call this as

    wscript.exec deletefile.vbs filename

    ---cut and save as deletefile.vbs---
    Dim fso, filename
    filename = ObjArgs(1)

    Set fso = CreateObject("Scripting.FileSystemObject")
    fso.DeleteFile(filename)

    Set fso=nothing

  5. #5
    Join Date
    Oct 2005
    Posts
    17
    txs skhanal!!

    Also some files are residing on a userID and Password protected FTP server.
    Do you perhaps also know how to access these files in the same vbs script?

  6. #6
    Join Date
    Oct 2005
    Posts
    17
    Some files are residing on a userID and Password protected FTP server.
    Does anyone perhaps know how to access these files?

  7. #7
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    DTS can access FTP server to transfer files using FTP Task.

  8. #8
    Join Date
    Oct 2005
    Posts
    17
    That is correct, but I need to delete the files residing on this FTP Server.

  9. #9
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    I don't think you can do that with DTS FTP Task, but you can write a batch file to connect and delete files and run this within a DTS package. If you need to delete files older than certain date, then it becomes little tricky, in that you case you have to use VBScript to dynamically generate file list by using FTP Task, then use the batch file to delete.

  10. #10
    Join Date
    Oct 2005
    Posts
    17
    oh ok, and....how? (I'm a newbie in this...)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •