home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / vrac / homonlib.zip / FILESIZE.BAS < prev    next >
BASIC Source File  |  1995-04-13  |  752b  |  31 lines

  1. DEFINT A-Z
  2.  
  3. ' $INCLUDE: 'DIR.INC'
  4.  
  5. DECLARE FUNCTION FileSize& (file$)
  6.  
  7. FUNCTION FileSize& (file$)
  8. '****************************************************************************
  9. 'Returns a long integer representing the file size of a single file or the
  10. ' combined size of multiple files if a wildcard is passed.
  11. '
  12. 'Should the file(s) not be found, the function will return zero.
  13. '
  14. '****************************************************************************
  15.  
  16. DIM DirInfo AS DirType                  'This should be easy to follow.
  17.  
  18. totsize& = 0
  19.  
  20. f$ = Dir$(file$, DirInfo)
  21.  
  22. DO WHILE LEN(f$) AND DirInfo.ErrorCode = 0
  23.     totsize& = totsize& + DirInfo.EntrySize
  24.     f$ = Dir$("", DirInfo)
  25. LOOP
  26.  
  27. FileSize& = totsize&
  28.  
  29. END FUNCTION
  30.  
  31.