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
Returns the size of a directory in bytes.
Warning This function may take a relatively long time to execute, depending on the size of the directory to be analyzed.
Example
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)Ajax
ResTaille is int
// Taille du répertoire "C:\MesDocuments"
ResTaille = fDirSize("C:\MesDocuments")
// Affichage lisible
Info("La taille du répertoire est : " + LengthToString(ResTaille))
Syntax
<Result> = fDirSize(<Directory path> [, <Options>])
<Result>: Integer
  • Size of the directory in bytes,
  • -1 if an error or an interruption occurred. To get more details on the error, use ErrorInfo with the errMessage constant.
Note: hidden files are taken into account when calculating directory size.
<Directory path>: Character string
Name and full (or relative) path of the directory to use (up to 260 characters). A UNC path can be used. Wildcard characters (*,?) are not allowed.
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 Under iPhone/iPad, on both the device and the emulator, the file system is read-only. An application can only write to its installation directory or one of its subdirectories.
<Options>: Integer constant or combination of constants (optional)
Type of iteration performed for the directory files:
fdIgnoreErrorIf a directory cannot be browsed, it is ignored. If this constant is not specified, fDirSize returns an error.
fdInterruptibleThe iteration can be interrupted by pressing ESC. The function will return the name of directories listed until the interruption.
WEBDEV - Server codeLinux 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.
Remarks

Handling errors

fDirSize throws an error in the following cases:
  • the specified directory does not exist,
  • the name of the directory is invalid,
  • the operation was interrupted by the user.
Component: wd300std.dll
Minimum version required
  • Version 12
This page is also available for…
Comments
Exemplo fDirSize/LengthToString
Exemplo fDirSize/LengthToString

s_diretorio is string="E:\_clientes_atualizacoes\_Windev_Erp_Matos\"
n_tamanho_diretorio is int=fDirSize(s_diretorio)
EDT_texto=LengthToString(n_tamanho_diretorio,sizeB)+CR
EDT_texto+=LengthToString(n_tamanho_diretorio,sizeGB)+CR
EDT_texto+=LengthToString(n_tamanho_diretorio,sizeKB)+CR
EDT_texto+=LengthToString(n_tamanho_diretorio,sizeMB)+CR
EDT_texto+=LengthToString(n_tamanho_diretorio,sizeTB)+CR

//Blog com video e exemplo:
http://windevdesenvolvimento.blogspot.com.br/2016/09/curso-windev-arquivos-010-arquivos.html
https://www.youtube.com/watch?v=5PFR3pfXC2w
De matos AMARILDO
02 Sep. 2016

Last update: 03/27/2025

Send a report | Local help