ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / External file functions
  • Handling errors
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Lists the subdirectories of a given directory and returns the full paths of listed subdirectories.
Other uses: For each directory found, fListDirectory can automatically call a special procedure written in WLanguage. This procedure is used to handle the current directory. In this case, fListDirectory returns the number of listed directories.
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)PHPAjax
UnRépertoire, ResListeRépertoire are strings
RépertoireAlister is string
RépertoireAlister = "C:\MesDocuments"

// Liste tous les répertoires présents dans RépertoireAlister.
ResListeRépertoire = fListDirectory(RépertoireAlister)
// Pour chaque répertoire trouvé
FOR EACH STRING UnRépertoire OF ResListeRépertoire SEPARATED BY CR
	// Ajout du répertoire dans la table TABLE_TableRep
	TableAdd(TABLE_TableRep, UnRépertoire)
END
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)PHPAjax
RépertoireAlister = "C:\MesDocuments"

// Liste les répertoires présents dans RépertoireAlister.
// La procédure AttributRepertoire retourne le nombre de répertoires en lecture seule.
ResListeRépertoire = fListDirectory(RépertoireAlister, "AttributRépertoire")
Syntax

Listing the subdirectories of a directory Hide the details

<Result> = fListDirectory(<Path of initial directory> [, <Options>])
<Result>: Character string
Name of listed directories, separated by CR characters (Carriage Return).
<Path of initial directory>: Character string
Path of directory from which the subdirectories will be sought.
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 installation directory or one of its subdirectories, as well as to the external memory (SDCard).
iPhone/iPadIOS WidgetMac Catalyst 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>: Integer constant or combination of constants (optional)
Options that can be taken into account:
fdInterruptibleThe iteration can be interrupted by pressing ESC. The function will return the name of directories listed until the interruption.
WEBDEV - Server code 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.
WINDEVWEBDEV - Server codeReports and QueriesAndroidAndroid Widget iPhone/iPadIOS WidgetMac CatalystJavaUser code (UMC)PHPAjax

Listing the subdirectories of a directory by calling a procedure for each directory Hide the details

<Result> = fListDirectory(<Path of initial directory> , <WLanguage procedure> [, <Pointer> [, <Options>]])
<Result>: Integer
Number of listed directories.
<Path of initial directory>: Character string
Path of directory from which the subdirectories will be sought.
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 installation directory or one of its subdirectories, as well as to the external memory (SDCard).
iPhone/iPadIOS WidgetMac Catalyst 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 directory. This procedure is used to handle the current directory.
For more details on this procedure, see Parameters of the procedure used by fListDirectory.
<Pointer>: Optional integer
Pointer passed to <Procedure name>.
<Options>: Combination of Integer constants
Type of iteration performed for the directory files:
fdInterruptibleThe iteration can be interrupted by pressing ESC. The function will return the number of directories listed until the interruption.
WEBDEV - Server code 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.
Remarks

Handling errors

Caution: fListDirectory does not return an error code.. To determine if this function has generated an error, use ErrorInfo with the errMessage constant.
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: wd300std.dll
Minimum version required
  • Version 10
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/24/2024

Send a report | Local help