Advertisement
3_2004-2005 Files/ File Controls/ Input/ Output #137867

Get file size up to a terabyte

Returns the file size of the file name passed in the format the user specifies

AI

Tóm tắt bởi AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Mã nguồn
original-source
Function FileSize(ByVal strFile As String, Optional ByVal ReturnAs As FileSizeView = fsBytes) As Double
 'Purpose: Returns the file size of the file name passed in the format the user specifies
 Dim dblLen As Double, lngIndex As Long
 'If file doesn't exist, abort
 If Dir(strFile) = Empty Then
  FileSize = 0
  Exit Function 'Abort
 End If
 'Returns the file length in bytes
 dblLen = FileLen(strFile)
 'Calculate to the file size view passed
 For lngIndex = 0 To ReturnAs
  dblLen = dblLen / 1024
 Next
 'Return the file size
 FileSize = dblLen
End Function
Bình luận gốc (3)
Được khôi phục từ Wayback Machine