MyChat Scripts Engine: FileSize
Function to get the file's size on the disk in bytes.
Syntax
function FileSize(sFileName: string): integer;
Parameters and return values
Parameter |
Type |
Value |
sFileName |
string |
file name and full path. |
Function result
Result |
Value |
-1 |
specified file or path does not exist; |
>0 |
accurate size of the file in bytes. Files with the size >2GB are determined correctly in the NTFS file system. |
Example
begin
mLogScript('MyChat Server core files size:', '');
mLogScript('mcserv.exe - ' + IntToKbyte(FileSize(mGetServerServiceFolder(3) + 'mcserv.exe')), '');
mLogScript('mcserv.db - ' + IntToKbyte(FileSize(mGetServerServiceFolder(1) + 'db\mcserv.db')), '');
mLogScript('history.db - ' + IntToKbyte(FileSize(mGetServerServiceFolder(1) + 'db\history.db')), '');
end.
Script work result
[19:56:52] (Log "FileSize"): MyChat Server core files size:
[19:56:52] (Log "FileSize"): mcserv.exe - 14.4 MB
[19:56:52] (Log "FileSize"): mcserv.db - 9.03 MB
[19:56:52] (Log "FileSize"): history.db - 112 MB
[20:17:51] (Run "ExtractFileParts"): Script operation time: 5 ms
[20:17:51] (Run "ExtractFileParts"): Script done successfully.