AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de archivos externos
  • Handling errors
  • Listing the subdirectories of a directory
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Lists the files found in a directory and returns the list of files. The listed files are sought from the given directory.
Other use: For each file found, the fListFile function can automatically call a specific procedure written in WLanguage.. This procedure is used to handle the current file. In this case, fListFile returns the number of listed files.
Note Under 64-bit Windows, access to a system directory from a 32-bit executable may be made in a different directory from the one expected. For more details, see Native 64-bit and native 32-bit.
Reportes y Consultas
AFile, ResListFile are strings
// Lists the ".BMP" files found in "C:\MyDocuments".
// The iteration is also performed in the subdirectories and it can be interrupted. 
ResListFile = fListFile("\MyDocuments\*.BMP", frRecursive + fdInterruptible)
// For each file found
FOR ALL ResListeFile UnFile CHAINS SEPARATED by CR
	// Add the file into TABLE_FileTable
	TableAdd(TABLE_FileTable, AFile)
END
Reportes y Consultas
// Lists the ".BMP" files found in "C:\MyDocuments".
// The FileAttribute procedure returns the number of read-only files.
ResListFile = fListFile("C:\MyDocuments\*.BMP", "FileAttribute")
Sintaxis

Listing the files found in a directory Ocultar los detalles

<Result> = fListFile(<Path and generic name of files> , <Options>)
<Result>: Character string
Full name of listed files, separated by CR characters (Carriage Return).

Warning The function returns files whose short or long name matches the filter.
<Path and generic name of files>: Character string
Path and generic name of files to list. Generic characters (* and?) are allowed. Special cases:
  • if directory and drive are not specified the search path is based on the current drive and the current directory for that drive.
  • if drive not specified but directory specified the search path is created from the current drive and the directory passed as a parameter.
  • if the drive is specified while the directory is not specified, the search path is built from the specified drive and from the current directory for this drive.
Windows This parameter can be in Ansi or Unicode format.
<Options>: Combination of Integer constants
Option used to define the information returned as well as the type of iteration performed for the directory files:
fdFullInformationEach line (separated by carriage return - CR) contains the following information:
<Full file name> + TAB + <Size in bytes> + TAB +
<Date of last modification> + TAB + <File attributes>
The date is in YYYYMMDDHHmmSS format. The attributes are identical to the ones returned by fAttribute.
fdInterruptibleThe iteration can be interrupted by pressing ESC. The function will return the name of the listed files until the interruption.
frNoHiddenDirectoryIf the frFullInformation constant is used, the hidden directories are not listed (attribute = "H").
frNoHiddenFileIf the frFullInformation constant is used, the hidden files are not listed (attribute = "H").
frNotRecursiveThe iteration is non-recursive. Subdirectories are ignored.
frRecursive
(Default value)
The iteration is recursive. Subdirectories are automatically taken into account.
fUnicodePath<Result> will be a string in Unicode format.

Reportes y Consultas

Listing the files found in a directory by calling a procedure for each file Ocultar los detalles

<Result> = fListFile(<Path and generic name of files> , <WLanguage procedure> [, <Pointer> [, <Options>]])
<Result>: Integer
Number of listed files.
<Path and generic name of files>: Character string
Path and generic name of files to list. Generic characters (* and?) are allowed. Special cases:
  • if directory and drive are not specified the search path is based on the current drive and the current directory for that drive.
  • if drive not specified but directory specified the search path is created from the current drive and the directory passed as a parameter.
  • if the drive is specified while the directory is not specified, the search path is built from the specified drive and from the current directory for this drive.
<WLanguage procedure>: Procedure name
Name of the WLanguage procedure ("callback") called for each listed file. This procedure is used to handle the current file. For more details on this procedure, see Parameters of the procedure used by fListFile.
<Pointer>: Optional integer
Pointer passed to <WLanguage procedure>.
<Options>: Optional Integer constant (or combination of constants)
Type of iteration performed for the directory files:
fdInterruptibleThe iteration can be interrupted by pressing ESC.
frNotRecursiveThe iteration is non-recursive. Subdirectories are ignored.
frRecursive
(Default value)
The iteration is recursive. Subdirectories are automatically taken into account.
fUnicodePath<Result> will be a string in Unicode format.
Observaciones

Handling errors

Caution: fListFile returns no error code. To determine if this function has generated an error, use ErrorInfo with the errMessage constant.
Reportes y Consultas

Listing the subdirectories of a directory

To list the subdirectories of a directory, use fListDirectory.
Tip It is also possible to list directories within a directory with the function fListFile.
Example:
fListFile("c:\temp\anim\.", proc) 
// Don't forget the '.' at the end of string to identify the directories
PROCEDURE proc(Dir, file, nChange, ptr) 
Trace(Dir)
Componente: wd300std.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 28/03/2025

Señalar un error o enviar una sugerencia | Ayuda local