ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

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 file (in bytes).
Example
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)Ajax
// Ouverture d'un fichier externe
MonFichierTxt is DiskFile
ResTaille is int
IF MonFichierTxt.Ouvre("C:\MesRépertoires\Fichier.txt", foReadWrite) THEN
	// Taille d'un fichier
	ResTaille = MyFile.Taille()
END
Syntax

Getting the size of a file according to its path Hide the details

<Result> = <File path>.Size()
<Result>: Integer
  • File size in bytes,
  • -1 if an error occurred. To get more details on the error, use ErrorInfo with the errMessage constant.
When handling files exceeding 2 GB, <Result> must correspond to an 8-byte integer.
<File path>: DiskFile variable
Name of the DiskFile variable initialized with <DiskFile variable>.Open, <DiskFile variable>.Create or <DiskFile variable>.OpenTempFile.
Remarks

Handling errors

<DiskFile variable>.Size throws an error in the following cases:
  • the specified file does not exist,
  • the name of the specified file is invalid.
Note: <DiskFile variable>.Size does not work on hidden files.
Business / UI classification: Business Logic
Component: wd300std.dll
Minimum version required
  • Version 28
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/26/2024

Send a report | Local help