7. p:file-move

The p:file-move step moves a file or directory.

<p:declare-step type="p:file-move">
     <p:output port="result" primary="true" content-types="application/xml"/>
     <p:option name="href" required="true" as="xs:anyURI"/>        
     <p:option name="target" required="true" as="xs:anyURI"/>      
     <p:option name="fail-on-error" as="xs:boolean" select="true()"/>
</p:declare-step>

The p:file-move step moves the file or directory named in href to the new location specified in target. If the target option specifies an existing directory, the step attempts to move the file or directory into that directory, preserving its base name.

Conformant processors must support URIs whose scheme is file for the href and target options of p:file-move. It is implementation-defined what other schemes are supported by p:file-move, and what the interpretation of ‘directory’, ‘file’ and ‘contents’ is for those schemes. It is a dynamic error (err:XC0148) if an implementation does not support p:file-move for a specified scheme.

If href or target are relative, they are made absolute against the base URI of the element on which they are specified (p:with-option or p:file-move in the case of a syntactic shortcut value). It is a dynamic error (err:XD0064) if the base URI is not both absolute and valid according to [RFC 3986]. It is a dynamic error (err:XC0149) if p:file-move is not available to the step due to access restrictions in the environment in which the pipeline is run.

If the href option specifies a device or other special kind of object, the results are implementation-defined.

If the move is successful, the step returns a c:result element containing the absolute URI of the target.

If an error occurs and fail-on-error is false, the step returns a c:error element which may contain additional, implementation-defined, information about the nature of the error.

If an error occurs and fail-on-error is true, one of the following errors is raised:

  • It is a dynamic error (err:XD0011) if the resource referenced by the href option does not exist, cannot be accessed or is not a file or directory.

  • It is a dynamic error (err:XC0115) if the resource referenced by the target option is an existing file or other file system object.

  • It is a dynamic error (err:XC0050) if the directory cannot be moved to the specified location.

Document properties

The resulting document has no properties apart from content-type. In particular, it has no base-uri.