From dc488533f94c5ad67a790c082ae80e5790b8d374 Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Fri, 17 Aug 2012 14:37:57 -0400 Subject: [PATCH] FileByteSize function --- mdl/m_fileio.pas | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/mdl/m_fileio.pas b/mdl/m_fileio.pas index 163bb9c..d4c2339 100644 --- a/mdl/m_fileio.pas +++ b/mdl/m_fileio.pas @@ -39,6 +39,7 @@ Procedure DirClean (Path: String; Exempt: String); Function FileRename (OldFN, NewFN: String) : Boolean; Function FileCopy (Source, Target: String) : Boolean; Function FileFind (FN: String) : String; +Function FileByteSize (FN: String) : Int64; { GLOBAL FILEIO VARIABLES AND CONSTANTS } @@ -746,4 +747,17 @@ Begin FindClose(Dir); End; -End. \ No newline at end of file +Function FileByteSize (FN: String) : Int64; +Var + Dir : SearchRec; +Begin + Result := -1; + + FindFirst (FN, AnyFile, Dir); + + If DosError = 0 Then Result := Dir.Size; + + FindClose(Dir); +End; + +End.