Difference between revisions of "GetFiles"

From SCAR Divi Manual
Jump to: navigation, search
(Availability)
 
Line 1: Line 1:
 
==Definition==
 
==Definition==
 
<source lang="scar" lines="false">
 
<source lang="scar" lines="false">
function GetFiles(Path, Ext: string): TStringArray;
+
function GetFiles(const Path, Ext: string): TStrArray;
 
</source>
 
</source>
  
 
==Availability==
 
==Availability==
 
SCAR Divi 3.00 > Current
 
SCAR Divi 3.00 > Current
 +
 +
===Notes===
 +
*Did not work 100% correctly until 3.39
  
 
==Description==
 
==Description==
This function generates a list of all files in a given directory specified by '''Path''' with the file extension specified in '''Ext''' (without leading point) and returns it as a [[TStringArray]]. This function is not recursive and only returns the name (with extension) of the files. The '''Ext''' parameter does allow the usage of [http://en.wikipedia.org/wiki/Wildcard_character wildcards].
+
This function generates a list of all files in a given directory specified by '''Path''' with the file extension specified in '''Ext''' (without leading point) and returns it as a [[TStrArray]]. This function is not recursive and only returns the name (with extension) of the files. The '''Ext''' parameter does allow the usage of [http://en.wikipedia.org/wiki/Wildcard_character wildcards].
  
 
==Example==
 
==Example==
 
<source lang="scar">
 
<source lang="scar">
 
var
 
var
   sa: TStringArray;
+
   sa: TStrArray;
 
   i: Integer;
 
   i: Integer;
  

Latest revision as of 02:39, 2 February 2013

Definition

function GetFiles(const Path, Ext: string): TStrArray;

Availability

SCAR Divi 3.00 > Current

Notes

  • Did not work 100% correctly until 3.39

Description

This function generates a list of all files in a given directory specified by Path with the file extension specified in Ext (without leading point) and returns it as a TStrArray. This function is not recursive and only returns the name (with extension) of the files. The Ext parameter does allow the usage of wildcards.

Example

var
  sa: TStrArray;
  i: Integer;

begin
  sa := GetFiles(IncludesPath, '*');
  for i := Low(sa) to High(sa) do
    WriteLn(sa[i]);
end.

See Also