From: Kurt Euler Date: 2002-08-31T13:42:39+09:00 Subject: HT copy a directory structure, and all files to a single director y... All- Recently Matz and others advised the code below for recursively reading file names in a directory structure. (It works fine.) Follow up questions: -- How can I expand this (or use related) code to copy the directory structure and files to a parallel directory where the target directories aren't already there. (Eg, recreate the whole structure in "../dupe_structure".) -- A slightly different objective here: Assuming all files in the directories have unique names, how can I copy all files to a single target directory. (It seems to me this would involve parsing f somehow to extract just the file name. In the code below, f includes the path too.) Thanks! -Kurt for f in Dir.glob("./**/*") File.open(f) { |file| puts f do_more_stuff_here } if File.file?(f) end