fs.attributes

From ComputerCraft
Jump to navigation Jump to search

fs.attributes
Function
Syntax
fs.attributes()
Returns table attributes
API fs
Source CC:Tweaked (source)

Get the Attributes of a File or Directory.

The function will return a table with this content:
isDir: If the path is a directory
size: The size of the path (Same as fs.getSize)
created: The time, the path was created
modification: The time, the path was modified

ExampleExamplePrintattributes
Print the attributes of /test.
Code
tAttr = fs.attributes("/test")
if tAttr["isDir"] then
    print("/test" is a directory")
else:
    print("/test is a file")
print("The size of /test is " .. tAttr["size"] .. " Bytes")
print("/test was created at " .. tAttr["created"])
print("/test was modified at " .. tAttr["modification"])
Output It will print all attributes of a /test.