I am attempting to open a directory, open each file and send each line of the file to a network host. I can get the code to work for a single file, but the script fails with a "permission denied" error when I attempt to do this for each file in a directory. *****CODE***** IPADDR= "some ip address" OUTPORT = "some ip port" INDIR = "some directory" dir = Dir.open(INDIR) dir.each do |f| file = File.open(f,"r") streamSock = TCPSocket::new(IPADDR,OUTPORT) while(line = file.gets) streamSock.send(line,0) end streamSock.close file.close end *****END CODE****** any help greatly appreciated Thank you. -- Posted via http://www.ruby-forum.com/.