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.
WINDEVReportes y ConsultasCódigo de Usuario (UMC)PHPAjax
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
WINDEVWEBDEV - Código ServidorReportes y ConsultasJavaCódigo de Usuario (UMC)PHPAjax
// 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.
WindowsLinux This parameter can be in Ansi or Unicode format.
AndroidWidget Android This parameter can correspond to a full path or a path relative to the current directory (returned by fCurrentDir). This parameter is case-sensitive.
Reminder: In Android, the file system is read-only on the device and on the emulator. An application can only write to its installation directory or one of its subdirectories, as well as to the external memory (SDCard).
iPhone/iPad This parameter can correspond to a full path or a path relative to the current directory (returned by fCurrentDir). This parameter is case-sensitive.
Reminder: On iPhone or iPad, an application has the rights to write to its installation directory or one of its subdirectories
<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.

PHP This parameter is ignored.
WINDEVWEBDEV - Código ServidorReportes y ConsultasAndroidWidget Android iPhone/iPadJavaCódigo de Usuario (UMC)PHPAjax

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.
AndroidWidget Android This parameter can correspond to a full path or a path relative to the current directory (returned by fCurrentDir). This parameter is case-sensitive.
Reminder: In Android, the file system is read-only on the device and on the emulator. An application can only write to its installation directory or one of its subdirectories, as well as to the external memory (SDCard).
iPhone/iPad This parameter can correspond to a full path or a path relative to the current directory (returned by fCurrentDir). This parameter is case-sensitive.
Reminder: On iPhone or iPad, an application has the rights to write to its installation directory or one of its subdirectories
<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.
PHP The name of the procedure must correspond to a character string in quotes.
<Pointer>: Optional integer
Pointer passed to <WLanguage procedure>.
PHP Parameter passed to the function. This parameter is not necessarily an integer (it can be a string, ...).
<Options>: Optional Integer constant (or combination of constants)
Type of iteration performed for the directory files:
fdInterruptibleThe iteration can be interrupted by pressing ESC.
WEBDEV - Código ServidorLinux This constant has no effect.
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.
PHP This parameter is ignored. The iteration is non-recursive and cannot be interrupted.
Observaciones

Handling errors

Caution: fListFile returns no error code. To determine if this function has generated an error, use ErrorInfo with the errMessage constant.
WINDEVWEBDEV - Código ServidorReportes y ConsultasAndroidWidget Android iPhone/iPadJavaCódigo de Usuario (UMC)Ajax

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