# ROR commands to create a folder

**URL:** <https://www.ruby-forum.com/t/ror-commands-to-create-a-folder/123613>\
**Category:** Rails\
**Created:** [December 19, 2007, 6:06am UTC](https://www.ruby-forum.com/t/ror-commands-to-create-a-folder/123613 "2007-12-19T06:06:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ed8c4c/32.png) [@nad](https://www.ruby-forum.com/u/nad)\
**Post date:** [December 19, 2007, 6:06am UTC](https://www.ruby-forum.com/t/ror-commands-to-create-a-folder/123613/1 "2007-12-19T06:06:37Z")

</div>

hi All

does any one have tried to create a folder from a ROR command.

in my application i want to check weather their is existing folder with  
a given name and if it does not exists to make a new folder.

is some one have tried this pls tell me how to achieve this  
\

Thanks.  
Nadeehsa

---

<div class="post-metadata">

**Author:** ![nad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ed8c4c/32.png) [@nad](https://www.ruby-forum.com/u/nad)\
**Post date:** [December 19, 2007, 6:41am UTC](https://www.ruby-forum.com/t/ror-commands-to-create-a-folder/123613/2 "2007-12-19T06:41:11Z")

</div>

> does any one have tried to create a folder from a ROR command.
> 
> in my application i want to check weather their is existing folder with  
> a given name and if it does not exists to make a new folder.
> 
> is some one have tried this pls tell me how to achieve this

See the ruby docs, in particular the File and Dir class.

* * *

File.directory?(file\_name) =\> true or false

Returns true if the named file is a directory, false otherwise.

```
File.directory?(".")

```

* * *

Dir.mkdir( string [, integer] ) =\> 0

## Makes a new directory named by string, with permissions specified by the optional parameter anInteger. The permissions may be modified by the value of File::umask, and are ignored on NT. Raises a SystemCallError if the directory cannot be created. See also the discussion of permissions in the class documentation for File.

-philip
