From: Alex Maccaw Date: 2008-01-08T21:24:23+09:00 Subject: Finding the first file in a dir, fast, for message queue. I have a file based msg queue, and msgs are stored five folders down. When a request for the next msg is received, I need to grab the first file I can find, as fast as I can. I've tried Dir.glob, and only selecting the first file. This however is an awful way of doing it as it loads every file into memory, before selecting the first. A bit better is Find.find, which finds files incrementally. However, this still takes about 0.005 seconds (I presume since it's also 'finding' directories'). Is there a faster way to do this? -- Posted via http://www.ruby-forum.com/.