4 Replies Latest reply: May 15, 2014 10:00 AM by jonesmat _ RSS

    Run Batch File after Export Finishes

    akaras _

      Is there a way to make datapump run a batch file at the end of a job after the exports have been made.

       

      Thanks.

        • Run Batch File after Export Finishes
          Gareth Horton

          Akaras

           

          Use a Post-Export script.

           

          Choose Insert Script | Execute an external command line.

           

          Gareth

           

          Originally posted by akaras:

          Is there a way to make datapump run a batch file at the end of a job after the exports have been made.

           

          Thanks. /b[/quote]

          • Run Batch File after Export Finishes
            jonesmat _

            This seems so simple, but I cant get the batch File to Execute:

            Here is the Script and the Batch File it calls, simply the renaming of the Input File after everything has processed.

             

            From the Process..Process Properties->Script->PostProcess:

             

              <postprocess>Shell("""C:Program FilesMonarch Data PumpScriptsFIDSKED.BAT""",AppWinStyle.Hide,True)

            </postprocess>

               

             

            And Now the FIDSKED.BAT File:

             

            move airportserv03airdataairlineschedulesomnitrans.mdb

            airportserv03airdataairlineschedulesprocessed\%date%_omnitrans.mdb

            EXIT

             

             

            The FIDSKED.BAT file executes fine when run in the DOS window, but never seems to run when called as a PostProcess.

             

            Thanks

            • Run Batch File after Export Finishes
              Gareth Horton

              Hi,

               

              I cannot get this batch file to work, as the environment variable %date% returns the date in a format that is incompatible with file naming, e.g. 01/01/2006.

               

              It would probably be safer to use a combination of the command prompt and MDP macros in a script, unless you are comfortable with the .NET Framework and VB.NET, in which case you could just use the system.io.file namespace to do the job.

               

              Here is some script which you can paste into the script editor and adapt, which will move the file, with the convention MM_DD_YYYY, which should be a valid filename.

               

              [font="courier"]If Shell("""C:WINDOWSsystem32cmd.exe"""" "Log.ExpandMacros("/C move ""c:program filesmonarch eportsclassic.prn"" ""c:program filesmonarch eportsclassic&[mm]_&[dd]_&[yyyy].prn"),AppWinStyle.Hide,True,5000) <> 0 Then

                ' TODO: Handle command timeout here.

              End If[/font][/quote]Note that there is a timeout of 5 seconds.

               

              Plus, you would need to adapt the path to cmd.exe, if your Windows folder is different, C:WINNT, for example.

               

              Gareth

               

               

              Originally posted by jonesmat:

              This seems so simple, but I cant get the batch File to Execute:

              Here is the Script and the Batch File it calls, simply the renaming of the Input File after everything has processed.

               

              From the Process..Process Properties->Script->PostProcess:

               

                <postprocess>Shell("""C:Program FilesMonarch Data PumpScriptsFIDSKED.BAT""",AppWinStyle.Hide,True)

              </postprocess>

                 

               

              And Now the FIDSKED.BAT File:

               

              move airportserv03airdataairlineschedulesomnitrans.mdb

              airportserv03airdataairlineschedulesprocessed\%date%_omnitrans.mdb

              EXIT

               

               

              The FIDSKED.BAT file executes fine when run in the DOS window, but never seems to run when called as a PostProcess.

               

              Thanks /b[/quote]

              • Run Batch File after Export Finishes
                jonesmat _

                If you go to control panel, you can modify the date separator character to "-". Check the Regional and Language Options, under the Regional Options Tab, select customize and then click the date tab , under that tab you can change the date separator to "-". I will try your suggestions as well to see if they can work for me.