Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- [Program] F0RMATTER
- @version 1.0, "Deleting.."
- @author Hellkid98, HK98
- --]]
- local function centerPrint( y, text )
- local w, h = term.getSize()
- term.setCursorPos( w/2 - #text/2, y )
- write( text )
- print("")
- end
- local input
- repeat
- term.clear()
- term.setCursorPos( 1, 1 )
- term.setTextColor( colors.lime )
- centerPrint( 1, #fs.list("/") .. " files | Free Space " .. fs.getFreeSpace("/") .. " Kb\n" )
- term.setTextColor( colors.green )
- write("Format? (y/n): ")
- input = string.lower(read())
- until input:sub( 1,1 ) == "y" or input:sub( 1,1 ) == "n" or input:find( "yes" ) or input:find( "no" )
- if input:sub(1,1) == "y" or input:find( "yes" ) then
- for _, f in ipairs( fs.list("") ) do
- if not fs.isReadOnly( f ) and f ~= "disk" then
- term.setTextColor( colors.lime )
- print("Deleting [" .. f .. "]" )
- fs.delete( f )
- else
- term.setTextColor( colors.green )
- print("Ignored [" .. f .. "]" )
- end
- end
- term.setTextColor( colors.yellow )
- print("\nFormatting done! Press any key to continue" )
- os.pullEvent( "key" )
- end
- term.clear()
- term.setCursorPos( 1,1 )
- term.setTextColor( colors.white )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement