Advertisement
asteroidsteam

AntiFile

Oct 29th, 2017
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.25 KB | None | 0 0
  1. term.setCursorPos(1,1)
  2.   term.setBackgroundColor(colors.cyan)
  3.   term.clear()
  4.   term.setCursorPos(1,1)
  5.   term.setBackgroundColor(colors.red)
  6.   term.clearLine()
  7.   term.setCursorPos(1,1)
  8.   term.setTextColor(colors.white)
  9.   write("JOS AntiFile 1.1.2")
  10. function getFiles()
  11.   return fs.list("/")
  12. end
  13. function displayFiles()
  14.   term.setCursorPos(1,1)
  15.   term.setBackgroundColor(colors.cyan)
  16.   term.clearLine()
  17. term.setCursorPos(1,2)
  18.   term.setBackgroundColor(colors.cyan)
  19.   term.clearLine()
  20. term.setCursorPos(1,3)
  21.   term.setBackgroundColor(colors.cyan)
  22.   term.clearLine()
  23. term.setCursorPos(1,4)
  24.   term.setBackgroundColor(colors.cyan)
  25.   term.clearLine()
  26. term.setCursorPos(1,5)
  27.   term.setBackgroundColor(colors.cyan)
  28.   term.clearLine()
  29. term.setCursorPos(1,6)
  30.   term.setBackgroundColor(colors.cyan)
  31.   term.clearLine()
  32. term.setCursorPos(1,7)
  33.   term.setBackgroundColor(colors.cyan)
  34.   term.clearLine()
  35. term.setCursorPos(1,8)
  36.   term.setBackgroundColor(colors.cyan)
  37.   term.clearLine()
  38. term.setCursorPos(1,9)
  39.   term.setBackgroundColor(colors.cyan)
  40.   term.clearLine()
  41.   term.setCursorPos(1,1)
  42.   term.setBackgroundColor(colors.red)
  43.   term.clearLine()
  44.   term.setCursorPos(1,1)
  45.   term.setTextColor(colors.white)
  46.   write("JOS AntiFile 1.1.2")
  47.   term.setTextColor(colors.orange)
  48.   term.setCursorPos(1,2)
  49.   index = getFiles()
  50.   for i = 1, #index do
  51.     if (fs.isDir(index[i])) then
  52.       term.setBackgroundColor(colors.green)
  53.       write(index[i].." ")
  54.     else
  55.       term.setBackgroundColor(colors.blue)
  56.       write(index[i].." ")
  57.     end
  58.   end
  59.   term.setBackgroundColor(colors.cyan)
  60. end
  61. function remFile(file)
  62.   if (fs.exists(file)) then
  63.     fs.delete(file)
  64.     return true
  65.   else
  66.     return false
  67.   end
  68. end
  69. local x,y = term.getSize()
  70. while true do
  71.   displayFiles()
  72.   term.setCursorPos(1,math.floor(y-1))
  73.   term.clearLine()
  74.   term.setTextColor(colors.orange)
  75.   write("$ ")
  76.   term.setTextColor(colors.red)
  77.   input = read()
  78.   if (input == "reboot") then
  79.     disk.eject("right")
  80.     os.reboot()
  81.   else
  82.     if (remFile(input)) then
  83.       term.setCursorPos(1,y)
  84.       write("Successfully Deleted file!")
  85.     else
  86.       term.setCursorPos(1,y)
  87.       term.clearLine()
  88.       term.setCursorPos(1,y)
  89.       write("Error deleting File!")
  90.     end
  91.   end
  92. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement