lfs
LuaFileSystem.
lfs
lfs.attributes(filepath, aname) | This function uses stat internally thus if the given filepath is a symbolic link, it is followed (if it points to another link the chain is followed recursively) and the information is about the file it refers to. |
lfs.chdir(path) | Changes the current working directory to the given path. |
lfs.currentdir() | Returns a string with the current working directory. |
lfs.dir(path) | Lua iterator over the entries of a given directory. |
lfs.lock(filehandle, mode, start, length) | Locks a file or a part of it. |
lfs.lock_dir(path, seconds_stale) | Creates a lockfile (called lockfile.lfs) in path if it does not exist and returns the lock. |
lfs.mkdir(dirname) | Creates a new directory. |
lfs.rmdir(dirname) | Removes an existing directory. |
lfs.setmode(file, mode) | Sets the writing mode for a file. |
lfs.symlinkattributes(filepath, aname) | Identical to #lfs.attributes except that it obtains information about the link itself (not the file it refers to). |
lfs.touch(filepath, atime, mtime) | Set access and modification times of a file. |
lfs.unlock(filehandle, start, length) | Unlocks a file or a part of it. |
lfs
lfs.attributes(filepath, aname)
filepath
:
The filename.
aname
:
Where aname is an attribute. The attributes are described as follows; attribute mode is a string, all the others are numbers, and the time related attributes use the same time reference of os.time:
lfs.chdir(path)
path
:
Targeted directory
#nil, #string: In error cases, error string is provided.
lfs.currentdir()
lfs.dir(path)
dir_obj:next()
,
and explicitly close the directory before the iteration finished with
dir_obj:close()
. Raises an error if path is not a directory.
path
:
Directory to browse
Lua iterator over the entries of a given directory.
lfs.lock(filehandle, mode, start, length)
filehandle
:
Opened file
mode
:
"r" or "w"
start
:
(optional) Starting point.
length
:
(optional)
lfs.lock_dir(path, seconds_stale)
path
:
to lock
seconds_stale
:
tried when path already contains lockfile.lfs .
lfs.mkdir(dirname)
dirname
:
Name of the new directory.
lfs.rmdir(dirname)
dirname
:
Name of the directory to delete.
lfs.setmode(file, mode)
file
:
mode
:
The mode string can be either binary or text.
The previous mode string for the file.
lfs.symlinkattributes(filepath, aname)
filepath
:
The filename.
aname
:
An attribute name as in #lfs.attributes.
As in #lfs.attributes.
lfs.touch(filepath, atime, mtime)
filepath
:
The filename.
atime
:
The access time in seconds.
mtime
:
(optional) The modification time in seconds.
lfs.unlock(filehandle, start, length)
filehandle
:
Opened file
start
:
(optional) Starting point.
length
:
(optional)