Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local shell = require("shell")
- local fs = require("filesystem")
- local args, options = shell.parse(...)
- local file = args[1]
- size = fs.size(file)
- function round(num, idp)
- local mult = 10^(idp or 0)
- return math.floor(num * mult + 0.5) / mult
- end
- if not options.a and size >= 1024 then
- size = size / 1024
- size = round(size, 2)
- print("File size of " .. file .. " is " .. size .. " kilobytes.")
- elseif options.a == true or size <= 1024 then print("File size of " .. file .. " is " .. size .. " bytes.")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement