• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

lualfs

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

iter, dir_obj = lfs.dir (path)

Lua iterator over the entries of a given directory. Each time the iterator is called with dir_obj it returns a directory entry's name as a string, or nil if there are no more entries. You can also iterate by calling 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.

 

lfs.attributes(属性) (filepath [, aname])

Returns a table with the file attributes corresponding to filepath (or nil followed by an error message in case of error). If the second optional(可选择的) argument is given, then only the value of the named attribute is returned (this use is equivalent(等价的) to lfs.attributes(filepath).aname, but the table is not created and only one attribute is retrieved(检索)from the O.S.). 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(参考) ofos.time:

dev
on Unix systems, this represents the device(装置) that the inode resides(住) on. On Windows systems, represents the drive number of the disk containing the file
ino
on Unix systems, this represents the inode number. On Windows systems this has no meaning
mode
string representing the associated(关联的) protection mode (the values could be filedirectorylinksocketnamed pipechar deviceblock device or other)
nlink
number of hard links to the file
uid
user-id of owner (Unix only, always 0 on Windows)
gid
group-id of owner (Unix only, always 0 on Windows)
rdev
on Unix systems, represents the device(装置) type, for special file inodes. On Windows systems represents the same as dev
access
time of last access
modification
time of last data modification(修改)
change
time of last file status change
size
file size, in bytes
blocks
block allocated(分配) for file; (Unix only)
blksize
optimal(最佳的) file system I/O blocksize; (Unix only)

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. To obtain information about the link itself, see function lfs.symlinkattributes.


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Luaeval实现发布时间:2022-07-22
下一篇:
在lua的string库和正则表达式发布时间:2022-07-22
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap