file.size

Syntax file.size (path)

Params path is a legal path name to the file or folder whose size you wish to determine.

Action Calculates the size of the file in bytes.

Returns A number reflecting the size of the file in bytes.

Examples file.size ("C:\\Program Files\\Frontier\\Frontier.root")

   » 3446224

string.megabyteString (file.size ("C:\\Program Files\\Frontier\\Frontier.root"))

   » "3.9MB"

file.size ("C:\\Program Files\\Frontier\\")

   » 0

This script returns 0 because this verb does not calculate folder sizes.


file.size ("System:System Folder:System")

   » 883602

string.kBytes (file.size ("System:System Folder:System"))

   » 863K // Uses string.kBytes to convert returned value to K rather than displaying as bytes.

file.size ("System:System Folder:")

   » 0

This script returns 0 because this verb does not calculate folder sizes.


file.size ("System:")

   » 0

This script returns 0 because this verb does not calculate volume sizes.

Notes This is the size of both the data and resource forks.

The size of a folder is 0 - use file.bytesInFolder to determine the size of a folder.

The size of a disk volume is 0 - use file.bytesOnVolume for volumes.

See Also file.bytesInFolder

file.bytesOnVolume

Discuss