Difference between revisions of "ObjectType:filelist"

From Lavish Software Wiki
Jump to navigation Jump to search
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
== Description ==
 
== Description ==
 +
{{ObjectType-Vitals|file|[[LavishScript]]|none|NULL|filelist|no|void *}}
 +
 
This data type allows finding files and directories.
 
This data type allows finding files and directories.
 
== Members ==
 
== Members ==
*[[DataType:int|int]] '''Files''': Total file count
+
*[[ObjectType:int|int]] '''Files''': Total file count
*[[DataType:filelistentry|filelistentry]] '''File['''#''']''': The filelistentry of file <#>
+
*[[ObjectType:filelistentry|filelistentry]] '''File['''#''']''': The filelistentry of file <#>
 
== Methods ==
 
== Methods ==
 
*'''GetFiles['''*''']''': Gets all files from the given directory. (Defaults to current directory and * for files.)
 
*'''GetFiles['''*''']''': Gets all files from the given directory. (Defaults to current directory and * for files.)
Line 9: Line 11:
 
*'''Reset''': Clears the filelist.  
 
*'''Reset''': Clears the filelist.  
 
:'''Note''' GetFiles and GetDirectories does NOT clear the filelist.
 
:'''Note''' GetFiles and GetDirectories does NOT clear the filelist.
== Returns ==
+
 
'''none'''
 
 
== Examples ==
 
== Examples ==
 
  declare Count int 0
 
  declare Count int 0
Line 20: Line 21:
 
  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})
 
  {
 
  {
 
  echo File #${Count} = ${TestFileList.File[${Count}].Filename}
 
  echo File #${Count} = ${TestFileList.File[${Count}].Filename}
 
  }
 
  }
 +
 
== See Also ==
 
== See Also ==
* [[LavishScript:DataType:filelistentry|filelistentry]]
+
* [[ObjectType:filelistentry|filelistentry]]
* [[LavishScript:Data Types|Data Types]]
+
{{LavishScript:ObjectType}}
 
 
[[Category:LavishScript]]
 
[[Category:LavishScript Data Types]]
 

Latest revision as of 16:38, 8 July 2018

Description

Object Type Vitals
file
Defined By LavishScript
Inherits none
Reduces To NULL
Variable Object Type filelist
Uses Sub-Types no
C/C++ Type void *

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.

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}
}

See Also

LavishScript Object Types