FileUtils in widows

I am fairly new to ruby and am working with windows xp. I’m trying to
copy files from one directory to another using the FileUtils module.
When I run the program, I get a Permission Denied error (EACCES). Any
thoughts on how to get this to work?

files.each do |f|
next if f == “.” or f == “…”
FileUtils.copy(dir,newdir)
end

Thanks in advance for any help.

jjd

On Jul 28, 5:03 pm, Jonathan D. [email protected] wrote:

I am fairly new to ruby and am working with windows xp. I’m trying to
copy files from one directory to another using the FileUtils module.
When I run the program, I get a Permission Denied error (EACCES). Any
thoughts on how to get this to work?

files.each do |f|
next if f == “.” or f == “…”
FileUtils.copy(dir,newdir)

You forgot to use f in this line.

files.each do |f|
next if f == “.” or f == “…”
FileUtils.copy(dir,newdir)

You forgot to use f in this line.

Isn’t the f covered in the do statement? I’m not sure how else f would
be implemented.

On Jul 29, 8:24 am, Jon D. [email protected] wrote:

files.each do |f|
next if f == “.” or f == “…”
FileUtils.copy(dir,newdir)

You forgot to use f in this line.

Isn’t the f covered in the do statement? I’m not sure how else f would
be implemented.

FileUtils.copy(f, newdir)

Gavin S. wrote:

On Jul 29, 8:24 am, Jon D. [email protected] wrote:

files.each do |f|
next if f == “.” or f == “…”
FileUtils.copy(dir,newdir)

You forgot to use f in this line.

FileUtils.copy(f, newdir)

Thanks, works now. I stared at it so long I couldn’t see the obvious!

On Jul 28, 6:58 pm, Gavin S. [email protected] wrote:

FileUtils.copy(f, newdir)

Or
FileUtils.copy( “#{dir}/#{f}”, newdir)

FileUtils.copy isn’t a mind-reader.
It doesn’t know (or assume) that you have put
the name of the file in variable named f.
It doesn’t know that it is being invoked
inside of a loop.