var content = []; Dir.cwd.open.each { |file| file ~~ < . .. > && next; content.append(file); } content.sort.each { |file| say file; }