Type: |
Function |
Available as of: |
SystemInterface_1.34.1.0 |
Support for: |
- |
Versions: |
Current version |
The function runs through the complete directory content recursively and adds up the sizes of the files and folders. The size of directories in the RAM disk ("ram0:"), on the flash disk ("ide0:") and on a USB device ("/usb2msd16a" or "/usb2msd16b") can be read out.
The default device is "ide0:".
Input |
Data type |
Description |
---|---|---|
i_sDirPath |
STRING[1023] |
Name of the directory whose size has to be determined |
Input/Output |
Data type |
Description |
---|---|---|
iq_uliDirSize |
ULINT |
Size of the directory content in byte |
Data type |
Description |
---|---|
DINT |
0: Size has been read out successfully -1: Error when reading the size -318: At least one of the parameters is invalid |
Requirement
The size of the directory "ide0:/ESystem" shall be determined in Mb.
Declaration
PROGRAM ESystemDirSize
VAR
uliDirSize : ULINT := 0;
diStatus : DINT := 0;
diBytesOfMegaByte : DINT := 1048576; // = 1024 * 1024
diDirSizeInMB : LINT := 0;
END_VAR
Program
diStatus = FC_GetDirSize ( 'ide0:/ESystem', uliDirSize );
IF (diStatus = 0) THEN
diBytesOfMegaByte:= ULINT_TO_LINT(uliDirSize) / diBytesOfMegaByte;
END_IF
Result
diBytesOfMegaByte contains the size of the directory in mega byte.