Eyeon:Script/Reference/Libraries/eyeon/readdir
From VFXPedia
< Eyeon:Script | Reference | Libraries | eyeon
Contents |
Usage
readdir(string path)
- path (string, required)
A string containing the path to a directory
Returns
A table containing handles to file objects contained in the directory.
Remarks
The readdir function can be used to scan a directory, and all of its subdirectories. The table returned by this function contains filesystem objects, which have the following properties.
- IsDir
- A boolean indicating if the value is actually a directory
- Size
- A number indicating the size of the file, in bytes
- Name
- The name of the file or directory
- WriteTime
- The time at which the file was last written to
- AccessTime
- The last time the file was accessed
- CreateTime
- The time at which the file was created
- IsSystem
- A boolean indicating if the file or directories system attribute is set
- IsReadOnly
- A boolean indicating if the file or directories readonly attribute is set
- IsHidden
- A boolean indicating if the file or directories hidden attribute is set
- IsArchive
- A boolean indicating if the file or directories archive attribute is set
Requirements
- eyeonScript 5.0
Examples
-- List directory of C: root path = "C:/*.*" dir = readdir(path) num = table.getn(dir) for i = 1,num do if dir[i].IsDir == 1 then str = "[DIR]" else str = dir[i].Size end print(string.format("%-40s %10s", dir[i].Name, str)) end