RosettaCodeData/Task/Check-that-file-exists/Pluto/check-that-file-exists.pluto
2026-04-30 12:34:36 -04:00

16 lines
473 B
Text

for {"input.txt", "`Abdu'l-Bahá.txt"} as name do
if io.exists(name) then
print($"{name} file exists and has a size of {io.filesize(name)} bytes.")
else
print($"{name} file does not exist.")
end
end
local dir = "docs"
-- If it exists get number of files it contains.
if io.isdir(dir) then
local files = #io.listdir(dir)
print($"{dir} directory exists and contains {files} files.")
else
print($"{dir} directory does not exist.")
end