PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Managing the errors
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
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.
WEBDEV - Server codePHPAjax
ADirectory, ResListDirectory are strings
DirectoryToList is string
DirectoryToList = "C:\MyDocuments"
// Windows Mobile: DirectoryToList = "\MyDocuments"
 
// List all the directories present in DirectoryToList.
ResListDirectory = fListDirectory(DirectoryToList)
// For each directory found
FOR EACH STRING ADirectory OF ResListDirectory SEPARATED BY CR
// Add the directory into TABLE_DirTable
TableAdd(TABLE_DirTable, ADirectory)
END
WEBDEV - Server codePHPAjax
DirectoryToList = "C:\MyDocuments"
// Windows Mobile: DirectoryToList = "\MyDocuments"
 
 
// List the directories present in DirectoryToList.
// The DirectoryAttribute procedure returns the number of read-only directories.
ResListDirectory = fListDirectory(DirectoryToList, "DirectoryAttribute")
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 (with quotes)
Path of directory from which the subdirectories will be sought.
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.
<Options>: Integer constant or combination of constants (optional)
Options that can be taken into account:
fPathUNICODE
Versions 15 and later
<Result> will be a string in Unicode format.
New in version 15
<Result> will be a string in Unicode format.
<Result> will be a string in Unicode format.
fdInterruptibleThe browse can be interrupted by pressing the ESC key. The function will return the name of directories listed until the interruption.
WEBDEV - Server code 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.
WEBDEV - Server codePHPAjax

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 (with quotes)
Path of directory from which the subdirectories will be sought.
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.
<WLanguage procedure>: Procedure name
Name of 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 browse performed for the directory files:
fPathUNICODE
Versions 15 and later
<Result> will be a string in Unicode format.
New in version 15
<Result> will be a string in Unicode format.
<Result> will be a string in Unicode format.
fdInterruptibleThe browse can be interrupted by pressing the ESC key. The function will return the number of directories listed until the interruption.
WEBDEV - Server code 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.
Remarks

Managing the errors

Caution: fListDirectory returns no error code. To find out 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 : wd250std.dll
Minimum version required
  • Version 10
This page is also available for…
Comments
Video fListDiretory
https://youtu.be/tpuThghZguE
https://windevdesenvolvimento.blogspot.com/2019/09/dicas-2282-windev-webdev-mobile.html
// BTN_DIRETORIO_LISTA
s_arquivos_todos is string=fListDirectory(EDT_DIRETORIO)
s_arquivo_individual is string=""
TVT_DIRETORIO.DeleteAll()
FOR EACH STRING s_arquivo_individual OF s_arquivos_todos SEPARATED BY CR
nPOSICAO is int=TVT_DIRETORIO.AddLine()
TVT_DIRETORIO.COL_01_DIRETORIO[nPOSICAO]=s_arquivo_individual
END
amarildo
10 Sep. 2019
Exemplo fListDirectory
_nome_diretorio, _lista_diretorios are strings
IF YesNo("Somente Diretorios") THEN
_lista_diretorios=fListDirectory("D:\amarildo",frNotRecursive)
ELSE
_lista_diretorios=fListDirectory("D:\amarildo")
END
TableDeleteAll(TABLE_Diretorio)
FOR EACH STRING _nome_diretorio OF _lista_diretorios SEPARATED BY CR
TableAdd(TABLE_Diretorio,_nome_diretorio)
END

//Blog com Video e Exemplo
http://windevdesenvolvimento.blogspot.com.br/2016/09/curso-windev-arquivos-017-arquivos.html
https://www.youtube.com/watch?v=qCiBXw6xvqw
De matos AMARILDO
10 Sep. 2016