# Find files in directory

**URL:** <https://www.ruby-forum.com/t/find-files-in-directory/146494>\
**Category:** Rails\
**Created:** [August 21, 2008, 5:38pm UTC](https://www.ruby-forum.com/t/find-files-in-directory/146494 "2008-08-21T17:38:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rpierry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@rpierry](https://www.ruby-forum.com/u/rpierry)\
**Post date:** [August 21, 2008, 5:38pm UTC](https://www.ruby-forum.com/t/find-files-in-directory/146494/1 "2008-08-21T17:38:26Z")

</div>

Hi,

For my rails program I need to be able to look in a folder for an image  
file and then display the file name and image on screen.

I was wondering if it is possible to do that, and how the best way to do  
it would be?

Thanks a lot,  
Rob

---

<div class="post-metadata">

**Author:** ![rpierry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@rpierry](https://www.ruby-forum.com/u/rpierry)\
**Post date:** [August 21, 2008, 8:26pm UTC](https://www.ruby-forum.com/t/find-files-in-directory/146494/2 "2008-08-21T20:26:22Z")

</div>

Build a non-active record model that can looks thru the files in the  
directory, then handle whatever you need to do. Once you have the  
location of the file it shouldn’t be difficult to show it. Best if  
the folder of images is in the public directory.

On Thu, Aug 21, 2008 at 11:38 PM, Rob Pa  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Rob  
> –  
> Ramon T.

---

<div class="post-metadata">

**Author:** ![rpierry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@rpierry](https://www.ruby-forum.com/u/rpierry)\
**Post date:** [August 26, 2008, 4:33pm UTC](https://www.ruby-forum.com/t/find-files-in-directory/146494/3 "2008-08-26T16:33:38Z")

</div>

Thanks

The images would be placed in the public directory. I am just unsure how  
to code this, would I need to use dir.each or something along those  
lines?

Thanks
