OdiFileDelete

Usage

OdiFileDelete -DIR=<dir> | -FILE=<file> [-RECURSE=<yes|no>] [-CASESENS=<yes|no>] [-NOFILE_ERROR=<yes|no>] [-FROMDATE=<fromdate>] [-TODATE=<todate>]

Description

Deletes, based on the file modification time, files or a directory on the machine running the agent which executes it.

If -FROMDATE is omitted, all files with a modification date earlier than the -TODATE date will be deleted.

If -TODATE is omitted, all files with a modification date later than the -FROMDATE date will be deleted.

If both parameters are omitted, all files matching the -FILE parameter value will be deleted.

Parameters

Parameters

Mandatory

Description

-DIR=<dir>

Yes, if -FILE is omitted

  1. If -FILE is omitted, specifies the name of the directory (folder) to delete.

  2. If -FILE is supplied, specifies the path where files should be deleted from.

-FILE=<file>

Yes, if -DIR is omitted

Name or mask of file(s) to delete. If -DIR is not specified, then a full path should be given. Use * to specify wildcard characters.

Examples:

/var/tmp/*.log (all .log files in the directory /var/tmp)

/bin/arch_*.lst (all .list files starting with arch_)

-RECURSE=<yes|no>

No

  1. If -FILE is omitted, has no effect: all sub-directories are implicitly deleted.

  2. If -FILE is supplied, specifies that files should be deleted from this directory and from all sub-directories.

-CASESENS=<yes|no>

No

Specifies that Oracle Data Integrator should distinguish upper-case and lower-case when matching file names.

-NOFILE_ERROR=<yes|no>

No

Specifies that an error should be generated if the specified directory or files are not found. By default, no error is generated.

-FROMDATE=<fromdate>

 No

 All Files with a modification date later than this date will be deleted. The date needs to be provided in the format yyyy/MM/dd hh:mm:ss.

 The FROM_DATE is not inclusive.

-TODATE=<todate>

 No

 All Files with a modification date earlier than this date will be deleted. The date needs to be provided in the format yyyy/MM/dd hh:mm:ss.

 The TO_DATE is not inclusive.

Note: It is not possible to delete a file and a directory at the same time by combining the -DIR and -FILE parameters. To achieve that, you must make two calls to OdiFileDelete.

Examples

To delete the file my_data.dat from the directory c:\data\input, generating an error if it is missing.

OdiFileDelete -FILE=c:\data\input\my_data.dat -NOFILE_ERROR=yes

 

To delete all .txt files from the bin directory, but not .TXT files:

OdiFileDelete -FILE=c:\Program Files\odi\bin\*.txt -CASESENS=yes

 

This statement has the same effect:

OdiFileDelete -DIR=c:\Program Files\odi\bin -FILE=*.txt -CASESENS=yes

 

To delete the directory /bin/usr/nothingToDoHere :

OdiFileDelete -DIR=/bin/usr/nothingToDoHere

 

To delete all files under the C:\temp directory whose modification time is between 10/01/2008 00:00:00 and 10/31/2008 22:59:00 where 10/01/2008 and 10/31/2008 are not inclusive:

OdiFileDelete -DIR=C:\temp -FILE=* -NOFILE_ERROR=NO -FROMDATE=FROMDATE=10/01/2008 00:00:00 -TODATE=10/31/2008 22:59:00

 

To delete all files under the C:\temp directory whose modification time is earlier than the 10/31/2008 17:00:00. An error is thrown, if the directory contains no files to delete meeting the date criteria:

OdiFileDelete -DIR=C:\temp -FILE=* -NOFILE_ERROR=YES -TODATE=10/31/2008 17:00:00

 

To delete all files under the C:\temp directory whose modification time is later than 10/01/2008 08:00:00:

OdiFileDelete -DIR=C:\temp -FILE=* -NOFILE_ERROR=NO -FROMDATE=10/01/2008 08:00:00