PDA

View Full Version : Run Batch File after Export Finishes


akaras
December 8th, 2005, 02:26 PM
Is there a way to make datapump run a batch file at the end of a job after the exports have been made.

Thanks.

Gareth Horton
December 12th, 2005, 11:45 AM
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.

jonesmat
August 29th, 2006, 11:52 AM
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\%dat e%_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

Gareth Horton
August 31st, 2006, 03:17 PM
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.

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 IfNote 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\%dat e%_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

jonesmat
September 12th, 2006, 11:40 AM
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.