Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function help()
- print("Usage: scp <target ID> <filename>")
- end
- function main()
- if #arg < 2 then
- help()
- return
- end
- local target = arg[1]
- if not target then
- help()
- return
- end
- local filename = arg[2]
- if not filename then
- help()
- return
- end
- file = io.input(filename)
- cont = io.read("*all")
- local modem = peripheral.find("modem")
- if not modem then
- error("no modem")
- end
- peripheral.find("modem", rednet.open)
- print("Sending '".. filename .. "' to ID " .. target)
- rednet.send(tonumber(target), filename, "scp")
- rednet.send(tonumber(target), cont, "scp")
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement