Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local fileToMonitor = "yourfile.txt" -- Change this to your file name
- local interval = 5 -- Interval in seconds
- local function monitorFile()
- while true do
- if fs.exists(fileToMonitor) then
- -- Your code to send a message or perform actions when the file is found
- -- For example: redstone.setOutput("back", true)
- else
- -- Your code to run when the file is not found
- -- For example: shell.run("program_to_execute")
- end
- os.startTimer(interval)
- os.pullEvent("timer")
- end
- end
- local monitorThread = coroutine.create(monitorFile)
- coroutine.resume(monitorThread)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement