OdiFileWait

Usage

OdiFileWait -DIR=<dir> -PATTERN=<pattern> [-ACTION=<DELETE|COPY|MOVE|APPEND|ZIP|NONE>] -TODIR=<dest_dir> -TOFILE=<dest_file> [-OVERWRITE=<yes|no>] [-CASESENS=<yes|no>] [-FILECOUNT=<n>] [-TIMEOUT=<n>] [-POLLINT=<n>] [-HEADER=<n>] [-KEEP_FIRST_HEADER=<yes|no>] [-NOFILE_ERROR=<yes|no>]

Description

Scans the directory DIR and waits for files matching the mask given in PATTERN. When the specified files are found, the action indicated by the parameter ACTION is triggered.

The execution agent is in standby mode waiting to receive FILECOUNT files unless the timeout limit, given by TIMEOUT is reached. The directory is scanned every POLLINT milliseconds.

Parameters

Parameters

Mandatory

Description

-ACTION=

<DELETE|COPY|MOVE|APPEND|ZIP|NONE>

No

Action taken on the files found:

DELETE: Delete the files found

COPY: Copy the files found into the directory TODIR

MOVE: Move or rename the files found into folder TODIR by naming them as specified by TOFILE

APPEND: Concatenates all files found and creates a result file TOFILE. Source files are deleted.

ZIP: Zip the files found and store them into the ZIP file TOFILE

NONE: No action is performed. This is the default behaviour.

-DIR=<dir>

Yes

Directory (or folder) to scan

-PATTERN=<pattern>

Yes

Mask of filenames to scan. Use * to specify the generic characters.

Examples:

*.log (All files with the "log" extension)

arch_*.lst (All files starting with arch_ and with the extension "lst")

-TODIR=<dest_dir>

No

Target directory of the action. When the action is:

COPY: Directory where the files are copied

MOVE: Directory where the files are moved

-TOFILE=<dest_file>

No

 

Destination file(s). When the action is:

MOVE: Renaming mask of the moved files.

APPEND: Name of the file resulting from the concatenation.

ZIP: Name of the resulting ZIP file.

-OVERWRITE=<yes|no>

No

Indicates if the destination file(s) will be overwritten if they exist. By default, the value is set to no

Note that if this option is used with APPEND, then the target file will only have the contents of the latest file processed.

-CASESENS=<yes|no>

No

Indicates if file search is case sensitive. By default, searched files are uppercase.

-FILECOUNT=<n>

No

Maximum number of files to wait for (default is 0). If this number is reached, the command ends.

The value 0 indicates that we wait for all files until the timeout is reached.

If this parameter is 0 and the timeout is also 0, this parameter is then forced implicitly to 1.

-TIMEOUT=<n>

No

Maximum waiting time in milliseconds (default is 60000)

If this delay is reached, the command yields control to the following command, and this no matter what is the value of parameter FILECOUNT.

The value 0 is used to specify an infinite waiting time (wait until the maximum number of messages to read as specified in parameter FILECOUNT).

-POLLINT=<n>

No

Interval in milliseconds to search for new files. Default is set to 2000 (2 seconds), which means that Oracle Data Integrator looks for new messages every 2 seconds. Files written during the OdiFileWait are taken in account only after being closed (File size unchanged) during this interval.

-HEADER=<n>

No

This parameter is valid only for the APPEND action.

Number of header lines to suppress from the files before concatenation. Default is no processing.

-KEEP_FIRST_HEADER=<yes|no>

No

This parameter is only valid for the action APPEND.

It is used to keep the header lines of the first file during the concatenation

-NOFILE_ERROR=<yes|no>

No

Indicates the behavior to have if no file is found.

The value no (default) indicates that no error must be generated if no file is found.

Examples

Wait indefinitely for file flag.txt in directory c:\events and proceed when this file is detected.

OdiFileWait -ACTION=NONE -DIR=c:\events -PATTERN=flag.txt -FILECOUNT=1 -TIMEOUT=0 -POLLINT=1000

 

Wait indefinitely for file flag.txt in directory c:\events and suppress this file when it is detected.

OdiFileWait -ACTION=DELETE -DIR=c:\events -PATTERN=flag.txt -FILECOUNT=1 -TIMEOUT=0 -POLLINT=1000

 

Wait for the sales files *.dat for 5 minutes and scan every second in directory c:\sales_in, then concatenate into file sales.dat in directory C:\sales_ok. Keep the header of the first file.

OdiFileWait -ACTION=APPEND -DIR=c:\sales_in -PATTERN=*.dat -TOFILE=c:\sales_ok\sales.dat -FILECOUNT=0 -TIMEOUT=350000 -POLLINT=1000 -HEADER=1 -KEEP_FIRST_HEADER=yes -OVERWRITE=yes

 

Wait for the sales files *.dat for 5 minutes every second in directory c:\sales_in, then copy these files into directory C:\sales_ok. Do not overwrite.

OdiFileWait -ACTION=COPY -DIR=c:\sales_in -PATTERN=*.dat -TODIR=c:\sales_ok -FILECOUNT=0 -TIMEOUT=350000 -POLLINT=1000 -OVERWRITE=no

 

Wait for the sales files *.dat for 5 minutes every second in directory c:\sales_in then archive these files into a zip file

OdiFileWait -ACTION=ZIP -DIR=c:\sales_in -PATTERN=*.dat -TOFILE=c:\sales_ok\sales.zip -FILECOUNT=0 -TIMEOUT=350000 -POLLINT=1000 -OVERWRITE=yes

 

Wait for the sales files *.dat for 5 minutes every second into directory c:\sales_in, then move these files into directory C:\sales_ok. Do not overwrite. Append .bak to the file names.

OdiFileWait -ACTION=MOVE -DIR=c:\sales_in -PATTERN=*.dat -TODIR=c:\sales_ok -TOFILE=*.bak -FILECOUNT=0 -TIMEOUT=350000 -POLLINT=1000 -OVERWRITE=no