Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = { ... }
- -- Get all the files in the directory
- local sDir = shell.dir()
- if tArgs[1] ~= nil then
- sDir = shell.resolve( tArgs[1] )
- end
- -- Sort into dirs/files, and calculate column count
- local tAll = fs.list( sDir )
- local tFiles = {}
- local tDirs = {}
- local tHidden = {}
- local tHiddenDir = {}
- for n, sItem in pairs( tAll ) do
- if string.sub( sItem, 1, 1 ) ~= "." then
- local sPath = fs.combine( sDir, sItem )
- if fs.isDir( sPath ) then
- table.insert( tDirs, sItem )
- else
- table.insert( tFiles, sItem )
- end
- elseif string.sub( sItem, 1, 1) == "." then
- local sPath = fs.combine( sDir, sItem )
- if fs.isDir( sPath ) then
- table.insert( tHiddenDir, sItem)
- else
- table.insert( tHidden, sItem)
- end
- end
- end
- table.sort( tDirs )
- table.sort( tFiles )
- table.sort( tHidden )
- table.sort( tHiddenDir )
- if term.isColour() then
- textutils.pagedTabulate( colors.green, tDirs, colors.lightGray, tFiles, colors.orange, tHidden, colors.red, tHiddenDir )
- else
- textutils.pagedTabulate( tDirs, tFiles, tHidden )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement