PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN

  • Handling errors
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
Returns the size of a directory in bytes.
Caution: The execution of this function may take quite a long time depending on the size of the directory to analyze.
Example
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)Ajax
ResSize is int
// Size of "C:\MyDocuments" directory
ResSize = fDirSize("C:\MyDocuments")
// Readable display
Info("The size of the directory is: " + LengthToString(ResSize))
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.
Remark: the hidden files are taken into account when calculating the size of the directory.
<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 setup 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/iPad, 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.
<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: wd280std.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