B
Brian Wallace
[Note: parts of this message were removed to make it a legal post.]
I'm very new to Ruby, but I'm learning pretty quickly ..What i'm trying to
do is fairly simple...
I'd like to use Pathname, to return only actual filenames in the array...
For instance , using FileList.. You can just do this:
FileList["*.*"]
And it will return a string array with the filenames without directories..
But I rather like Pathname ... Since I can use it like this:
a = Pathname("/Path")
b = a.children
puts b[1] #==> "/Path/file1.txt"
b[1].read #==> "This is data in a file named file1.txt"
puts b[2] #==> "/Path/file2.txt"
.....
Does anyone have any tips on how I could use Pathname to return files only,
and not directories?
Thanks,
Brian
I'm very new to Ruby, but I'm learning pretty quickly ..What i'm trying to
do is fairly simple...
I'd like to use Pathname, to return only actual filenames in the array...
For instance , using FileList.. You can just do this:
FileList["*.*"]
And it will return a string array with the filenames without directories..
But I rather like Pathname ... Since I can use it like this:
a = Pathname("/Path")
b = a.children
puts b[1] #==> "/Path/file1.txt"
b[1].read #==> "This is data in a file named file1.txt"
puts b[2] #==> "/Path/file2.txt"
.....
Does anyone have any tips on how I could use Pathname to return files only,
and not directories?
Thanks,
Brian