os.loadAPI('/lib/cnt') local tArgs = { ... } if #tArgs < 1 then print( "Usage: getFile [local_file]" ) return end local r_filename = tArgs[1] local l_filename = shell.resolve(fs.getName(r_filename)) print(l_filename) tmp = fs.open('/etc/ftp.conf','r') local fileserver = tostring(tmp.readLine()) fs_id = cnt.lookup(fileserver) message=textutils.serialize({'FTP',r_filename}) rednet.send(fs_id,message) local senderId, reply, distance = rednet.receive() reply = textutils.unserialize(reply) while senderId ~= fs_id and reply[1] ~= 'FTP' do local senderId, reply, distance = rednet.receive() reply = textutils.unserialize(reply) end if reply[2] > 0 then l_file=fs.open(l_filename,'w') l_file.write(reply[3]) l_file.close() else print("File not found: "..r_filename) end