INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Usefull Functions & Procedures

VFP Function to determine file size. by EzLogic
Posted: 7 Nov 03 (Edited 20 Nov 03)

* 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)

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close