-- new version of list/ls; adds '/' to end of directories local tArgs = { ... } local showDotFiles = false -- Get all the files in the directory local sDir = shell.dir() if #tArgs >= 1 then if tArgs[1] ~= nil then sDir = shell.resolve( tArgs[1] ) end if tArgs[2] then -- option passed in if tArgs[2] == "-a" then showDotFiles = true end end end -- Sort into dirs/files, and calculate column count local tAll = fs.list( sDir ) local tFiles = {} local tDirs = {} local function addItem(_item) local sPath = fs.combine(sDir, _item) if fs.isDir( sPath ) then _item = _item table.insert( tDirs, _item ) else table.insert( tFiles, _item ) end end for n, sItem in pairs( tAll ) do if not showDotFiles then if string.sub( sItem, 1, 1 ) ~= "." then addItem(sItem) end else addItem(sItem) end end table.sort( tDirs ) table.sort( tFiles ) for k,v in pairs(tDirs) do tDirs[k] = v.."/" end textutils.pagedTabulate( tDirs, tFiles )