On Tue, May 10, 2011 at 5:35 AM, flebber <flebber.crue / gmail.com> wrote:
> On May 10, 5:34=A0am, 7stud -- <bbxx789_0... / yahoo.com> wrote:
>> File.split() doesn't do what you think it does, namely it does not
>> retrieve the files from the dir you specify. =A0I'm not sure why you thi=
nk
>> a method named split() would retrieve all the files from a directory.

> Also, what is the test at the end of the line supposed to do?
>
>> =A0# Todo when files process step into directory and redo.
>> =A0myFiles.each do|file|

OK, if you want to process multiple files you basically have these options:

Dir[]
Dir.glob
Find.find

The advantage of the first two being that you can use a glob pattern
to select files and do not have to do it manually.  Try this in IRB

Dir.glob('**/[0-9]*') {|f| p f, f.sub(/\A\d+/, '-')}

> Well in this first draft this check was just to ensure that no
> directory were processed, but I wanted to develop it into a nested
> test so the program would automatically process files in
> subdirectories.
>
> I need to review file.split for a suitable replacement.
>
> so speaking it out, and I no there is errors but I am off reading RDOC
> at moment :-) but this was the basic concept of where I was going.
>
> myFiles =3D Array.new << File.split(dir) unless File.file?("") then
> mydirs << Array.new
> for myFiles in mfdirs.each do |file|
> yadda yadda.

I am sorry, this is not a concept but few lines of source code.  As
long as your are not yet familiar with functionality of the language
it's probably easier to write down an algorithm in English words.
This also helps us understand what you are attempting to do.  Only
then we be helpful.

Kind regards

robert


--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/