Get a list of the names of the files contained in a directory.
 

1 file.list

<file.list filter='filter'>
    <file /> !
</file.list>
Example

Get the content of the directory c:\jas

Copy
<xsql-script name='file_list_sample1'>
    <body>
        <set name='m_path'>
            <string>c:<file.separator />jas</string>
        </set>
        <println trim='true'>
            Content of <string.space /><m_path/>:<string.lf />
            <file.list>
                <file name='#m_path' type='absolute' />
            </file.list>
        </println>
    </body>
</xsql-script>

The result showed by console, would be the following: Content of c:\jas: bin common conf dll etc logs server temp work

Example

Get the files with .log extension of the directory c:\windows

Copy
<xsql-script name='file_list_sample2'>
    <body>
        <set name='m_path'>
            <string>c:<file.separator />windows</string>
        </set>
        <println trim='true'>
            Content of <string.space /><m_path/><string.space />(files with log extension):<string.lf />
            <file.list filter='.*\.log'>
                <file name='#m_path' type='absolute' />
            </file.list>
        </println>
    </body>
</xsql-script>

The result showed by console, would be the following: Content of c:\windows (files with log extension):

  • 0.log
  • chipset.log
  • cmsetacl.log
  • comsetup.log
  • DtcInstall.log
  • FaxSetup.log
  • iis6.log
  • imsins.log
  • msgsocm.log
  • msmqinst.log
  • netfxocm.log
  • ntdtcsetup.log
  • ocgen.log
  • ocmsn.log
  • regopt.log
  • sessmgr.setup.log
  • setupact.log
  • setupapi.log
  • setuperr.log
  • spupdsvc.log
  • Sti_Trace.log
  • svcpack.log
  • tabletoc.log
  • tsoc.log
  • wiadebug.log
  • wiaservc.log
  • Windows Update.log
  • WindowsUpdate.log
  • wmsetup.log