# Re: How distinguish between a file and a directory?

**URL:** <https://www.ruby-forum.com/t/re-how-distinguish-between-a-file-and-a-directory/117404>\
**Category:** Ruby\
**Created:** [October 16, 2007, 5:12pm UTC](https://www.ruby-forum.com/t/re-how-distinguish-between-a-file-and-a-directory/117404 "2007-10-16T17:12:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![allen\_r](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c68b51/32.png) [@allen\_r](https://www.ruby-forum.com/u/allen_r)\
**Post date:** [October 16, 2007, 5:12pm UTC](https://www.ruby-forum.com/t/re-how-distinguish-between-a-file-and-a-directory/117404/1 "2007-10-16T17:12:45Z")

</div>

There are class side methods called “file?” and “directory?” on the File  
class that you can use. (ex. File.directory?(“path/to/directory”) )
