Cernunnos Manual


<delete-file>

Description:

Deletes the specified file or directory.

Reagents:

Name XPath Description Reagent Type Expected Type Required
CONTEXT @context Optional context from which missing elements of the LOCATION will be inferred if it is relative. If omitted, this task will use either: (1) the value of the 'Attributes.CONTEXT' request attribute if present; or (2) the directory within which Java is executing. PHRASE java.lang.String No
FILE @file Optional file system location of the file that will be deleted. It may be absolute or relative. If relative, the location will be evaluated from the CONTEXT. If omitted, the value of the 'Attributes.LOCATION' request attribute will be used. PHRASE java.lang.String No

Examples:

Invokes 'is-admin.crn' to deturmine if the user is an administrator, then either (1) deletes the file(s) specified on the command prompt or (2) gives the user appropriate feedback:

 
       
        <choose> 
          <when test="${crn(is-admin.crn)}"> 
            <argument-iterator> 
              <delete-file file="${Attributes.STRING}"/> 
            </argument-iterator> 
          </when>  
          <otherwise> 
            <echo-ln>You are not authorized to perform the specified action.</echo-ln> 
          </otherwise> 
        </choose>