Lupus590, on 25 October 2017 - 11:43 AM, said:
And to extend this:
http://www.computerc...fo/wiki/Fs.list
fs.list returns a table, so if you want to print all the files in the directory you need to loop through the table.
--# Find the monitor using peripheral.find
local monitor = peripheral.find( "monitor" )
local sPath = "/"
--# Setup the monitor
monitor.setTextScale(2)
monitor.setCursorPos(1, 1)
monitor.clear()
--# Redirect all output to the monitor
term.redirect( monitor )
--# Loop through the table and print all the files in the given directory
for _, name in ipairs(fs.list(sPath)) do
print( name )
end