PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Error management
  • Listing the subdirectories of a directory
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
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, fListFile 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.
Remark: In 64-bit Windows, the access to a system directory from a 32-bit executable can be performed in a directory that differs from the expected one. For more details, see Native 64-bit and native 32-bit.
Versions 15 and later
Android This function is now available for Android applications.
New in version 15
Android This function is now available for Android applications.
Android This function is now available for Android applications.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Stored procedures This function is now available in the code of stored procedures.
New in version 18
Android Widget This function is now available in Android widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Stored procedures This function is now available in the code of stored procedures.
Android Widget This function is now available in Android widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Stored procedures This function is now available in the code of stored procedures.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
WINDEVReports and QueriesUser code (UMC)PHPAjax
UnFichier, ResListeFichier are strings
// Liste les fichiers de type ".BMP" présents dans "C:\MesDocuments".
// Le parcours se fait également dans les sous-répertoires et est interruptible.
ResListeFichier = fListFile("C:\MesDocuments\*.BMP", frRecursive + fdInterruptible)
// Pour chaque fichier trouvé
FOR EACH STRING UnFichier OF ResListeFichier SÉPARÉE BY CR
// Ajout du fichier dans la table TABLE_TableFic
TableAdd(TABLE_TableFic, UnFichier)
END
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)PHPAjax
// Liste les fichiers de type ".BMP" présents dans "C:\MesDocuments".
// La procédure AttributFichier retourne le nombre de fichiers en lecture seule.
ResListeFichier = fListFile("C:\MesDocuments\*.BMP", "AttributFichier")
Syntax

Listing the files found in a directory Hide the details

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

Caution: 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 the directory and the drive are not specified: the search path is built from the current drive and from the current directory for this drive.
  • if the drive is not specified while the directory is specified: the search path is built from the current drive and from the directory passed as 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.
Versions 15 and later
WindowsLinux This parameter can be in Ansi or Unicode format.
New in version 15
WindowsLinux This parameter can be in Ansi or Unicode format.
WindowsLinux This parameter can be in Ansi or Unicode format.
AndroidAndroid Widget 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 setup directory or one of its subdirectories, as well as to the external memory (SDCard).
Versions 17 and later
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/iPad, an application has the rights to write into its setup directory or into one of its subdirectories.
New in version 17
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/iPad, an application has the rights to write into its setup directory or into one of its subdirectories.
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/iPad, an application has the rights to write into its setup directory or into one of its subdirectories.
<Options>: Combination of Integer constants
Option used to define the information returned as well as the type of browse performed for the directory files:
Versions 15 and later
fPathUNICODE
New in version 15
fPathUNICODE
fPathUNICODE
<Result> will be a string in Unicode format.
fdFullInformationEach line (separated by carriage return - CR) contains the following information:
<Nom du fichier complet> + TAB + <Taille en octets> + TAB +
<Date de dernière modification> + TAB + <Attributs du fichier>
The date is in YYYYMMDDHHmmSS format. The attributes are identical to the ones returned by fAttribute.
fdInterruptibleThe browse can be interrupted by pressing the ESC key. The function will return the name of the listed files until the interruption.
frNotRecursiveThe browse is a non-recursive browse. Subdirectories are ignored.
frRecursive
(Default value)
The browse is recursive. Subdirectories are automatically taken into account.
frNoHiddenFileIf the frFullInformation constant is used, the hidden files are not listed (attribute = "H").
frNoHiddenDirectoryIf the frFullInformation constant is used, the hidden directories are not listed (attribute = "H").

PHP This parameter is ignored.
WINDEVWEBDEV - Server codeReports and QueriesAndroidAndroid Widget iPhone/iPadJavaUser code (UMC)PHPAjax

Listing the files found in a directory by calling a procedure for each file Hide the details

<Result> = fListFile(<Path and generic name of files> , <WLanguage procedure> [, <Pointer> [, <Options>]])
<Result>: entier
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 the directory and the drive are not specified: the search path is built from the current drive and from the current directory for this drive.
  • if the drive is not specified while the directory is specified: the search path is built from the current drive and from the directory passed as 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.
AndroidAndroid Widget 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 setup directory or one of its subdirectories, as well as to the external memory (SDCard).
Versions 17 and later
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/iPad, an application has the rights to write into its setup directory or into one of its subdirectories.
New in version 17
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/iPad, an application has the rights to write into its setup directory or into one of its subdirectories.
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/iPad, an application has the rights to write into its setup directory or into one of its subdirectories.
<WLanguage procedure>: Procedure name
Name of the Procedure WLanguage (also called "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 browse performed for the directory files:
Versions 15 and later
fPathUNICODE
New in version 15
fPathUNICODE
fPathUNICODE
<Result> will be a string in Unicode format.
fdInterruptibleThe browse can be interrupted by pressing the ESC key.
WEBDEV - Server codeLinux This constant has no effect.
frNotRecursiveThe browse is a non-recursive browse. Subdirectories are ignored.
frRecursive
(Default value)
The browse is recursive. Subdirectories are automatically taken into account.
PHP This parameter is ignored. The browse is a non-recursive browse and it cannot be interrupted.
Remarks

Error management

Caution: fListFile returns no error code. To determine if this function has generated an error, use ErrorInfo with the errMessage constant.
WINDEVWEBDEV - Server codeReports and QueriesAndroidAndroid Widget iPhone/iPadJavaUser code (UMC)Ajax

Listing the subdirectories of a directory

To list the subdirectories of a directory, use fListDirectory.
Tip: fListFile can also be used to list the subdirectories of a directory.
Example:
fListFile("c:\temp\anim\.", proc)
// Ne pas oublier le '.' à la fin de la chaîne pour identifier les répertoires
PROCÉDURE proc(Rep, fichier, nChange, ptr)
Trace(Rep)
Related Examples:
The fListFile function Unit examples (WINDEV): The fListFile function
[ + ] Using fListFile and its syntax that directly returns the list of files/directories found in string format.
Component: wd270std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment