# Coping all files in a folder

**URL:** <https://www.ruby-forum.com/t/coping-all-files-in-a-folder/117927>\
**Category:** Ruby\
**Created:** [October 22, 2007, 3:59pm UTC](https://www.ruby-forum.com/t/coping-all-files-in-a-folder/117927 "2007-10-22T15:59:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f9ae1b/32.png) [@nick](https://www.ruby-forum.com/u/nick)\
**Post date:** [October 22, 2007, 3:59pm UTC](https://www.ruby-forum.com/t/coping-all-files-in-a-folder/117927/1 "2007-10-22T15:59:20Z")

</div>

require ‘ftools’

source=“c:\axis\FTP storage”  
dest=“c:\axis\images”  
For some reason this code will not work, I am not sure why. It will  
get into the loop with the copy state meant and then error.

dir.each do|file|  
copy= true  
puts “#{file}”

stop=gets

if file=="."  
copy=false  
end

if file=="…"  
copy=false  
end

if copy==true  
puts “I’m in”  
File.copy( “#{file}”, “#{dest}”)  
end

Any advice on what I am doing wrong would be great, I am pretty new to  
Ruby and programming in general.

Thanks  
Nick

end

---

<div class="post-metadata">

**Author:** ![nick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f9ae1b/32.png) [@nick](https://www.ruby-forum.com/u/nick)\
**Post date:** [October 22, 2007, 4:11pm UTC](https://www.ruby-forum.com/t/coping-all-files-in-a-folder/117927/2 "2007-10-22T16:11:43Z")

</div>

On Oct 22, 8:54 am, nick [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> if copy==true  
> end  
> Figured it out using FileUtils.Copy, thank anyways
