Skip to content

Instantly share code, notes, and snippets.

@semmons99
Created February 11, 2011 14:00
Show Gist options
  • Save semmons99/822378 to your computer and use it in GitHub Desktop.
Save semmons99/822378 to your computer and use it in GitHub Desktop.
def s3_find(filename)
keys = s3.directories.map do |directory|
directory.files.map do |file|
file.key if file.key =~ /.*#{filename}.*/
end
end
keys.flatten.compact
end
## OR ##
def s3_find(filename)
s3.directories.map{|directory|
directory.files.map{|file|
file.key if file.key =~ /.*#{filename}.*/
}
}.flatten.compact
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment