batch file help

  • Hey,

    I am newbie to batch files. Any help would be appreciated.

    I want to execute a dtsx package first and when complete execute an ant file.

    First, I want to check if any files (.txt) exists in a folder.

    IF exists *.txt in D:\folder

    if yes:

    (C:\SQL\ProjectName\bin - do I haveto set the path first?)

    execute dtexec /f mypackage.dtsx

    then:

    (D:\MyTools\bin)

    execute ant -buildfile D:\project\conf\file.xml

    If no files exists and folder is empty : quit

    Any help would be appreciated to guide me in the right direction.

    ~Jay

  • Jay H (2/19/2008)


    Hey,

    I am newbie to batch files. Any help would be appreciated.

    I want to execute a dtsx package first and when complete execute an ant file.

    First, I want to check if any files (.txt) exists in a folder.

    IF exists *.txt in D:\folder

    if yes:

    (C:\SQL\ProjectName\bin - do I haveto set the path first?)

    execute dtexec /f mypackage.dtsx

    then:

    (D:\MyTools\bin)

    execute ant -buildfile D:\project\conf\file.xml

    If no files exists and folder is empty : quit

    Any help would be appreciated to guide me in the right direction.

    ~Jay

    Here's a crack at it. You should fully qualify the path to dtexec.

    @echo off

    REM uncomment following line if Ant and SSIS paths have not been added to %PATH% at OS level

    REM PATH=%PATH%;D:\MyTools\bin;C:\SQL\ProjectName\bin

    REM Check for Files

    IF NOT EXIST D:\Folder\*.txt GOTO Exit

    dtexec /f \mypackage.dtsx

    ant -buildfile D:\project\conf\file.xml

    :Exit

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply