PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Managing 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
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
Reports and Queries
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 find out the error details, use ErrorInfo associated with the errMessage constant.
Note: 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. The wildcard characters (*,?) are not allowed.
Versions 15 and later
Windows This parameter can be in Ansi or Unicode format.
New in version 15
Windows This parameter can be in Ansi or Unicode format.
Windows This parameter can be in Ansi or Unicode format.
<Options>: Integer constant or combination of constants (optional)
Type of browse performed for the directory files:
fdInterruptibleThe browse can be interrupted by pressing the ESC key. The function will return the name of directories listed until the interruption.
frNotRecursiveThe browse is a non-recursive browse. The sub-directories are ignored.
frRecursive
(Default value)
The browse is a recursive browse. The sub-directories are automatically taken into account.
fdIgnoreErrorIf a directory cannot be browsed, it is ignored. If this constant is not specified, fDirSize returns an error.
Remarks

Managing errors

fDirSize generates 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 : wd250std.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