Get a list of the handlers of the files contained in a directory, if the path does not point to a directory,
the methode will return null.
1 file.listFiles
<file.listFiles
filter='filter'
sort-name='true'
sort-modified='false'
>
<file /> !
</file.listFiles>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Afilter | string | Regular expression. | |||
Asort-name | boolean | true | If it is true, the list of files is sorted in ascending order by name. | ||
Asort-modified | boolean | false | If it is true, the list of files is sorted in ascending order by modification date. |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Efile | file |
Returns | |
---|---|
Type | Description |
Arraylist | List of file handlers. |
Example
List the text files of the directory 'c:\windows':
Copy
<xsql-script name='file_listFiles_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.listFiles filter='.*\.log'> <file name='#m_path' type='absolute' /> </file.listFiles> </println> </body> </xsql-script>
The result showed by console, would be the following:
Copy
Content of c:\windows (files with log extension): c:\windows\0.log c:\windows\chipset.log c:\windows\cmsetacl.log c:\windows\comsetup.log c:\windows\DtcInstall.log c:\windows\FaxSetup.log c:\windows\iis6.log c:\windows\imsins.log c:\windows\msgsocm.log c:\windows\msmqinst.log c:\windows\netfxocm.log c:\windows\ntdtcsetup.log c:\windows\ocgen.log c:\windows\ocmsn.log c:\windows\regopt.log c:\windows\sessmgr.setup.log c:\windows\setupact.log c:\windows\setupapi.log c:\windows\setuperr.log c:\windows\spupdsvc.log c:\windows\Sti_Trace.log c:\windows\svcpack.log c:\windows\tabletoc.log c:\windows\tsoc.log c:\windows\wiadebug.log c:\windows\wiaservc.log c:\windows\Windows Update.log c:\windows\WindowsUpdate.log c:\windows\wmsetup.log