Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- rednet.open("top")
- term.clear()
- term.setCursorPos(1,1)
- if #args < 1 then
- print("Usage (<> Reqired, [] Optional:")
- print("sendfile [ComputerID] <File>")
- return
- end
- if #args == 1 then
- if fs.exists(args[1]) then
- textutils.slowPrint("Sending File "..args[1].."!")
- rednet.broadcast("RECEIVE")
- rednet.broadcast(args[1])
- file = fs.open(args[1], "r")
- rednet.broadcast(file.readAll())
- file.close()
- else
- print(args[1].." does not exists")
- return
- end
- else
- if fs.exists(args[2]) then
- textutils.slowPrint("Sending file "..args[2].." to "..args[1])
- F = rs.open(args[2], "r")
- id = tonumber(args[1])
- rednet.send(id, "RECEIVE")
- rednet.send(id, args[2])
- rednet.send(id, F.readAll)
- F.close()
- else
- print(args[2].." does not exists")
- return
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement