* Example of use:
* nSize = GetFileSize("C:\SomeFile.Ext")
* Returns:
* -2 if the file name is not passed
* -1 if the file passed as param was not found
* FileSize in Bytes
*********************
FUNCTION GetFileSize
PARAMETERS gcFileName && File to be checked
PRIVATE pnHandle,pnSize
IF PARAMETERS( ) = 0
RETURN -2 && Return -2 if no parameter passed
ELSE
IF !FILE(gcFileName)
RETURN -1 && Return -1 if file does not exist
ENDIF
ENDIF
pnHandle = FOPEN(gcFileName) && Open file
pnSize = FSEEK(pnHandle,0,2) && Determine file size, assign to pnSize
=FCLOSE(pnHandle) && Close file
RETURN pnSize && Return value
*********
Another way of doing it (Thanks for Baltman for the tip)
** I haven't tested it, I assume he had
?SizeArray(adir(SizeArray,"C:\SomeFile.Ext")+1)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.