Difference between revisions of "ObjectType:filelist"

From Lavish Software Wiki
Jump to navigation Jump to search
Line 16: Line 16:
 
  declare TestDirList filelist
 
  declare TestDirList filelist
 
  declare ScanDirectory filepath script ${LavishScript.CurrentDirectory}
 
  declare ScanDirectory filepath script ${LavishScript.CurrentDirectory}
  TestFileList:GetFiles[${ScanDirectory}/*.txt]
+
  TestFileList:GetFiles[${ScanDirectory}/\*.txt]
 
  TestDirList:GetDirectories[${ScanDirectory}]
 
  TestDirList:GetDirectories[${ScanDirectory}]
 
  ScanDirectory:Set[${ScanDirectory.File[1].FullPath}]
 
  ScanDirectory:Set[${ScanDirectory.File[1].FullPath}]
  TestFileList:GetFiles[${ScanDirectory}/*.txt]
+
  TestFileList:GetFiles[${ScanDirectory}/\*.txt]
 
  while (${Count:Inc}<=${TestFileList.Files})
 
  while (${Count:Inc}<=${TestFileList.Files})
 
  {
 
  {

Revision as of 15:33, 2 November 2006

Description

This data type allows finding files and directories.

Members

  • int Files: Total file count
  • filelistentry File[#]: The filelistentry of file <#>

Methods

  • GetFiles[*]: Gets all files from the given directory. (Defaults to current directory and * for files.)
  • GetDirectories[*]: Gets all directories from the given directory. (Defaults to current directory)
  • Reset: Clears the filelist.
Note GetFiles and GetDirectories does NOT clear the filelist.

Returns

none

Examples

declare Count int 0
declare TestFileList filelist 
declare TestDirList filelist
declare ScanDirectory filepath script ${LavishScript.CurrentDirectory}
TestFileList:GetFiles[${ScanDirectory}/\*.txt]
TestDirList:GetDirectories[${ScanDirectory}]
ScanDirectory:Set[${ScanDirectory.File[1].FullPath}]
TestFileList:GetFiles[${ScanDirectory}/\*.txt]
while (${Count:Inc}<=${TestFileList.Files})
{
echo File #${Count} = ${TestFileList.File[${Count}].Filename}
}

Operates On

CFileList *

This is an internal data type

See Also