FileSize[file]
gives the size of a file as a quantity.
FileSize
FileSize[file]
gives the size of a file as a quantity.
Details
Examples
open all close allBasic Examples (1)
Scope (2)
Get the file size for a File object:
FileSize[FindFile["ExampleData/GSM263810.txt"]]Find the size of a CloudObject:
obj = CloudPut[10!, CloudObject[]]FileSize[obj]Generalizations & Extensions (1)
FileSize uses SI prefix values for file size, where a megabyte is 106 bytes:
size = FileSize[File[FindFile["ExampleData/GSM263810.txt"]]]UnitConvert[size, "Kilobytes"]The resulting Quantity can be converted to other units using UnitConvert:
UnitConvert[size, "Kibibytes"]Applications (1)
Use FileSize with FileSystemMap to inspect the size of various files in a directory:
FileSystemMap[FileSize, $InstallationDirectory <> "/Documentation/English/System/ExampleData", FileNameForms -> "*.gz"]Properties & Relations (1)
FileSize gives the same number of bytes as FileByteCount:
FileByteCount[FindFile["ExampleData/ocelot.jpg"]]FileSize[FindFile["ExampleData/ocelot.jpg"]]See Also
Related Guides
Related Workflows
- Find the Size of a Notebook
History
Text
Wolfram Research (2017), FileSize, Wolfram Language function, https://reference.wolfram.com/language/ref/FileSize.html.
CMS
Wolfram Language. 2017. "FileSize." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FileSize.html.
APA
Wolfram Language. (2017). FileSize. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FileSize.html
BibTeX
@misc{reference.wolfram_2026_filesize, author="Wolfram Research", title="{FileSize}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/FileSize.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_filesize, organization={Wolfram Research}, title={FileSize}, year={2017}, url={https://reference.wolfram.com/language/ref/FileSize.html}, note=[Accessed: 12-June-2026]}