FileUtils in widows

J

Jonathan Dale

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
 
W

William James

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.
 
W

William James

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top