32 lines
871 B
Lua
32 lines
871 B
Lua
return function(argv, con)
|
|
local dir = argv[2] or ''
|
|
con.print(' Listing of '..dir ..'\n\n')
|
|
local d = fsLs(dir)
|
|
local dirs, files, tb = 0, 0, 0
|
|
for _, v in pairs(d) do
|
|
local i = fsInfo(dir..'/'..v)
|
|
con.print(os.date('%m/%d/%Y %I:%M %p ', i.modtime))
|
|
if i.type == 'directory' then con.print '<DIR>'
|
|
elseif i.type == 'symlink' then con.print '<SYM>'
|
|
elseif i.type == 'other' then con.print '<OTH>'
|
|
else con.print ' ' end
|
|
if i.type == 'directory' then
|
|
dirs = dirs + 1
|
|
con.print ' '
|
|
else
|
|
files = files + 1
|
|
tb = tb + i.size
|
|
con.print ' '
|
|
local s = tostring(i.size)
|
|
con.print((' '):rep(7 - #s))
|
|
con.print(s)
|
|
con.print ' '
|
|
end
|
|
|
|
con.println(v)
|
|
end
|
|
con.println(('%d File(s)\n%d Dir(s)\n%d Bytes total')
|
|
:format(files, dirs, tb))
|
|
con.print '\n'
|
|
end
|