From: "Jesús Gabriel y Galán" Date: 2012-07-04T18:59:41+09:00 Subject: Re: Copying Files On Wed, Jul 4, 2012 at 11:55 AM, Alex C. wrote: > Jan E. wrote in post #1067361: >> Alex C. wrote in post #1067360: >>> Still doesn't work :( >> >> What doesn't work? If no file is copied, then it's simply because >> there's no "FileUtils.copy". The code above only selects the files that >> should be copied. >> >> >>> Does file_path need to be changed to target_path, as that's what I've >>> defined above it? >> >> No, file_path is the block parameter referring to the current file. > > require 'fileutils' > > original_path, target_path = > 'D:/Stuff/Ruby', 'C:/new' > > ignore_folder = 'D:/Stuff/Ruby/2/' > copy_files = Dir["#{original_path}/**/*.*"].reject do |file_path| > file_path.start_with? ignore_folder > end > > FileUtils.copy Dir["#{original_path}/**/*.*"], target_path > Thats what I have, and it now copies all the files, but hasn't ignored a > file thats in D:/Stuff/Ruby/2/ - which is what I wanted..hmmph FileUtils.copy copy_files, target_path you need to use the array you calculated previously. Jesus.