FindAllFiles/es

From Free Pascal wiki
Revision as of 09:54, 20 July 2016 by Jma sp (talk | contribs) (→‎FindAllFiles - españo)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Unit: Lazarus fileutil (UTF-8 replacements for FPC RTL code and additional file/directory handling)

See also:

function FindAllFiles(const SearchPath: String; SearchMask: String = '';
  SearchSubDirs: Boolean = True): TStringList;

findallfiles looks for files matching the searchmask in the SearchPath directory and if specified its children and returns a stringlist with the resulting filenames.

The mask can be a single mask like you can use with the FindFirst/FindNext functions, or it can consist of a list of masks, separated by a semicolon (;).
Spaces in the mask are treated as literals.

Ejemplo:

uses 
...
fileutil
...
var
  PascalFiles: TStringList;
begin
  //No es necesario crear stringlist ya que la función la crea automáticamente.
  PascalFiles := FindAllFiles(LazarusDirectory, '*.pas;*.pp;*.p;*.inc', true); // Encuentra e.g. todos los ficheros fuentes de Pascal
  try
    showmessage(Format('Encontrados %d ficheros fuentes de Pascals',[PascalFiles.Count]));
  finally
    PascalFiles.Free;
  end;
Note-icon.png

Nota: Si necesita utilizar esta función desde programas de línea de mandatos, entonces añade un requerimiento de proyecto para LCLBase, which will not pull in the entire LCL