<delete>

Purpose/Function

Delete files and/or directories. One or more URIs can be added. Alternatively, one can indicate a directory or a pattern, which will force an ls- operation first.

Attributes

NAME

TYPE

DEFAULT VALUE

DESCRIPTION

cleanup

boolean

true

delete the cache(s) upon termination of the operation

copyCache

ncsa.tools.trebuchet.core.cache.CopyCache

null

delete the source entries in this cache

copyCacheFile

java.io.File

null

delete the source entries in this cache

dir

java.net.URI

null

delete this entire directory

listCache

ncsa.tools.trebuchet.core.cache.ListCache

null

delete the entries in this cache

listCacheFile

java.io.File

null

delete the entries in this cache

Listener control attributes

NAME

TYPE

DEFAULT VALUE

DESCRIPTION

event

boolean

true

if listener is a ProgressListener, send an event

log4j

boolean

false

if listener is a ProgressListener, use log4j

stdout

boolean

false

if listener is a ProgressListener, use stdout

Elements

TAG

TYPE

COUNT

DESCRIPTION

<configuration>

ncsa.tools.trebuchet.core.types.TrebuchetConfiguration

0:1

configuration with additional non-default settings

<pattern>

ncsa.tools.common.types.uri.UriPattern

0:1

pattern to use with ls-operation

<uri>

java.net.URI

0:N

locations of files to delete

Listener elements

TAG

TYPE

COUNT

DESCRIPTION

<listener>

ncsa.tools.trebuchet.core.IOperationListener

0:N

generic tag, must be used in conjunction with xmlns:absoluteTag namespace

<logging-listener>

ncsa.tools.trebuchet.core.IOperationListener

0:N

built-in type; see listeners

<file-progress-listener>

ncsa.tools.trebuchet.core.IOperationListener

0:N

built-in type; see listeners

<list-progress-listener>

ncsa.tools.trebuchet.core.IOperationListener

0:N

built-in type; see listeners

<list-metadata-listener>

ncsa.tools.trebuchet.core.IOperationListener

0:N

built-in type; see listeners

ReturnValues

DEFAULT NAME

TYPE

delete

ncsa.tools.trebuchet.core.operations.CacheBasedOperation

NOTES

  • For a given task, added URIs must all have the same scheme and endpoint.
  • Cleanup defaults to true, so caches that are used will be deleted unless otherwise indicated. The operation is returned only if cleanup is false.
  • includeAncestors is always false for this task; the ancestors of individually added <uri> elements cannot be deleted (more systematic deletion requires either the directory URI or a pattern).
  • If directories which remain empty after the deletion should also be deleted, delete-all-empty-dirs must be explicitly set to true in the configuration (see example below).
  • It is possible to by-pass adding either URIs or a UriPattern by pointing the task at pre-existing caches, either as objects in the environment or as files.
  • Any additional settings passed in using the configuration object will be added to the default settings (the latter must be explicitly overridden if they are not desired).
  • An Ls- operation done in conjunction with <delete> by adding a <pattern> or setting dir will automatically set the list-recursive property to true.

Examples

<ogrescript>
   <delete uri="file:/tmp/dir0/file-0"/>
   <delete>
        <configuration>
           <property name="delete-all-empty-dirs" value="true" type="boolean"/>
        </configuration>
   	<pattern base="file:/tmp/dir0/">
   	   <include>**/file-1</include>
   	</pattern>
   </delete>
   <delete>
      <uri>file:/tmp/dir1/file-3</uri>
      <uri>file:/tmp/dir1/file-7</uri>
   </delete>
   <delete dir="file:/tmp/dir2"/>
   ...	
</ogrescript>
  • No labels