I am trying to search for all files of a given type in a given folder and copy them to a new folder.
I need to specify a root folder and search through that folder a
You want the Find module. Find.find takes a string containing a path, and will pass the parent path along with the path of each file and sub-directory to an accompanying block. Some example code:
require 'find'
pdf_file_paths = []
Find.find('path/to/search') do |path|
pdf_file_paths << path if path =~ /.*\.pdf$/
end
That will recursively search a path, and store all file names ending in .pdf in an array.