ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / External file functions
  • 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 file (in bytes).
Example
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)Ajax
// Open an external file
MyTextFile is DiskFile
ResSize is int
IF MyTextFile.Open("C:\MyDirectories\File.txt", foReadWrite) THEN
// Size of a file
ResSize = MyFile.Size()
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.
Remark: <DiskFile variable>.Size does not operate on the 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: 10/23/2023

Send a report | Local help