Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("enter filename")
- filename = read()
- --REMEMBER TO CLOSE FILE
- function openFile()
- fs.makeDir("saves")
- file = fs.open("saves/" .. filename, "r")
- end
- function getLineCount()
- openFile()
- i = 0
- while file.readLine() do
- i = i + 1
- end
- file.close()
- end
- mon = peripheral.wrap("left")
- mon.clear()
- mon.setCursorPos(1,1)
- mon.setTextScale(1)
- mon.write("currently displaying: " .. filename)
- getLineCount()
- openFile()
- mon.setCursorPos(1,2)
- b=2
- for x = 1,i do
- l = file.readLine()
- mon.write(l)
- b = b+1
- mon.setCursorPos(1,b)
- end
- file.close()
- fs.makeDir("backup")
- newfile = fs.open("backup/" .. filename, "w")
- newfile.writeLine(filename)
- newfile.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement