Difference between revisions of "Fs.getSize"

From ComputerCraft Wiki
Jump to: navigation, search
m (Moved to CAT:LuaCoreFunctions)
(Explain what this actually does, with reference to the forum post)
Line 5: Line 5:
 
|returns=bytes
 
|returns=bytes
 
|api=fs
 
|api=fs
|desc=Gets the size of a file
+
|desc=Gets the size of a file. This is not actually the exactly length of the file in bytes; rather, it is the amount that the file contributes towards the computer’s or disk’s storage quota. This is either 512 bytes or the actual length of the file plus the length of its name, whichever is larger.[http://www.computercraft.info/forums2/index.php?/topic/12243-152fsgetsize-returns-unexpected-values/]
 
|examples=
 
|examples=
 
{{Example
 
{{Example

Revision as of 19:11, 21 April 2013


Grid Redstone.png  Function fs.getSize
Gets the size of a file. This is not actually the exactly length of the file in bytes; rather, it is the amount that the file contributes towards the computer’s or disk’s storage quota. This is either 512 bytes or the actual length of the file plus the length of its name, whichever is larger.[1]
Syntax fs.getSize(string path)
Returns bytes
Part of ComputerCraft
API fs

Examples

Grid paper.png  Example
Get the size of the shell from the ROM and print it
Code
print( fs.getSize("/rom/programs/shell") )