From: Matthew Moss Date: 2008-12-13T23:37:06+09:00 Subject: Re: Creating directory structures > Starting with a base directory, we will say "foo", I need to iterate > through all subdirectories, gathering only files that contain certain > characters in their name. That part was easy, and it is returning the > array like I mentioned previously. Should I be doing it differently? That seems like a quite reasonable way to do it. > After gathering the files, a new file is created for each file > gathered, and placed in a seperate location, with a new base > directory. > The structure of the subdirectories must be maintained however. I'm > having an immensly difficult time getting this to work. I've tried > several different options, what do you guys think the best way to > handle > this task would be? Once you have an array of the source files, you should be able to create a list of the potential new files by replacing part of the source paths (using String#gsub). After that, enumerate your files, creating the directory (using File.dirname) and then creating the file.