Cernunnos Manual


<copy-file>

Description:

Copies the resource specified by LOCATION to the chosen location, creating missing directories as necessary. None of this task's reagents are strictly required, but you will normally want to specify either TO_DIR or TO_FILE at a minimum.

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. The default is the value of the 'Attributes.CONTEXT' request attribute (if present) or the directory from which Java is executing (otherwise). PHRASE java.lang.String No
LOCATION @location Optional location of a resource; if omitted, the value of the 'Attributes.LOCATION' request attribute will be used. LOCATION may be a filesystem path or a URL, and may be absolute or relative; if a relative value is provided, it will be resolved based on the value of CONTEXT. PHRASE java.lang.String No
TO_DIR @to-dir Optional file system directory to which the specified resource will be copied. It may be absolute or relative. If relative, it will be evaluated from the directory in which Java is executing. PHRASE java.lang.String No
TO_FILE @to-file Optional file system path to which the specified resource will be copied. It may be absolute or relative (in which case the location will be evaluated relative to the TO_DIR). If omitted, the the value of the 'Attributes.LOCATION' request attribute will be used. PHRASE java.lang.String No

Examples:

Copies the document at 'http://www.google.com' to the file 'google_home.html':

 
       
        <copy-file location="http://www.google.com" to-file="google_home.html"/> 
       
    

Copies all files from 'some_folder' to 'another_folder':

 
       
        <file-iterator dir="some_folder"> 
          <copy-file to-dir="another_folder"/> 
        </file-iterator>