# Which File Classto use

**URL:** <https://www.ruby-forum.com/t/which-file-classto-use/159364>\
**Category:** Ruby\
**Created:** [February 3, 2009, 9:59pm UTC](https://www.ruby-forum.com/t/which-file-classto-use/159364 "2009-02-03T21:59:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![devrubygem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ac8455/32.png) [@devrubygem](https://www.ruby-forum.com/u/devrubygem)\
**Post date:** [February 3, 2009, 9:59pm UTC](https://www.ruby-forum.com/t/which-file-classto-use/159364/1 "2009-02-03T21:59:36Z")

</div>

I am new to Ruby and would like to create a small project that deals  
with the file system. The parameters I would like to pass in the command  
window would be, how many iterations I would like to run, how many  
folders I would like to create, how many files I would like to put  
inside those folders, how many I want to open, and close. In the  
processI would like to rename the folders and files, and change its  
attributes.  
Is there one specificfile class I use. or many. I’m have no clue.Do some  
classes do the same thing, is one better to use then the other?

I just would like to be pointed in the right direction to get started,  
then figure everything else out on my own.

Kindest Regards  
Zayd

---

<div class="post-metadata">

**Author:** ![devrubygem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ac8455/32.png) [@devrubygem](https://www.ruby-forum.com/u/devrubygem)\
**Post date:** [February 4, 2009, 1:05am UTC](https://www.ruby-forum.com/t/which-file-classto-use/159364/2 "2009-02-04T01:05:27Z")

</div>

Best thing to do is build your program one step at a time. Pick one  
feature - say asking number of iterations and doing the loop, putting  
a print command to simply show that it’s doing something in mock of  
the actual code for creating folders and files. Then add the next  
thing. Use irb to experiment with the classes to test things out. For  
instance, to find out how to use the file class, open irb then ask  
File what methods it responds to with File.methods, then try some out.

Blog: [http://random8.zenunit.com/](http://random8.zenunit.com/)  
Learn rails: [http://sensei.zenunit.com/](http://sensei.zenunit.com/)

---

<div class="post-metadata">

**Author:** ![devrubygem](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ac8455/32.png) [@devrubygem](https://www.ruby-forum.com/u/devrubygem)\
**Post date:** [February 4, 2009, 5:41am UTC](https://www.ruby-forum.com/t/which-file-classto-use/159364/3 "2009-02-04T05:41:00Z")

</div>

Julian L. wrote:

> Best thing to do is build your program one step at a time. Pick one  
> feature - say asking number of iterations and doing the loop, putting  
> a print command to simply show that it’s doing something in mock of  
> the actual code for creating folders and files. Then add the next  
> thing. Use irb to experiment with the classes to test things out. For  
> instance, to find out how to use the file class, open irb then ask  
> File what methods it responds to with File.methods, then try some out.
> 
> Blog: [http://random8.zenunit.com/](http://random8.zenunit.com/)  
> Learn rails: [http://sensei.zenunit.com/](http://sensei.zenunit.com/)

Thanks!!! Im guessing I can create an array of those iterations? I see  
that there are a bunch of file classes, and some carry more methods then  
others, im also guessing that i would be using of. Ourse the file method  
and use say require ‘FileUtil’ to access more methods that are not in  
the File class. Please correct me if im wrong 🙂
