<list-paths>

Purpose/Function

Iterates through a ListCache to produce a list of relative paths, absolute paths or URIs.

Attributes

NAME

TYPE

DEFAULT VALUE

DESCRIPTION

cache

ncsa.tools.trebuchet.core.data.ListCache

required

cache returned from an Ls operation

type

java.lang.String

absPath

choice of absPath, relPath, uriString, or uri; in the latter case, a list of java.net.URI objects is returned; otherwise, a list of strings

dirs

boolean

false

if true, list only directories; default is to list only file entries

global

boolean

false

assign or declare as global variable

assign

java.lang.String

null

assign list to this variable name

declare

java.lang.String

null

declare list using this variable name

pattern

java.lang.String

null

RegExp pattern to use to filter the entries (optional)

toFile

java.lang.String

null

instead of returning a list, write the result directly to this file

append

boolean

false

append to the file rather than overwriting

Examples

<ogrescript>
   <declare name="cache" />
   <ls>
        <pattern base="file:/Users/arossi/Documents">
           <include>*.*</include>
        </pattern>
        <return-value assignedName="cache" defaultName="listCache"/>
   </ls>
   <list-paths cache="${cache}" declare="paths" type="uriString" pattern=".*.pdf"/>
   <write-lines path="/tmp/pathList.txt">
      <lines>${paths}</lines>
   </write-lines>
</ogrescript>

<ogrescript>
   <declare name="cache" />
   <ls>
        <pattern base="file:/Users/arossi/Documents">
           <include>*.*</include>
        </pattern>
   <return-value assignedName="cache" defaultName="listCache"/>
   </ls>
   <list-paths cache="${cache}" toFile="/tmp/pathList.txt" type="uriString" pattern=".*.pdf"/>
</ogrescript>
  • No labels