From: Ransom Tullis Date: 2009-02-06T07:54:51+09:00 Subject: Recursive directory rename problem Problem: - trying to standardize on a naming convention for all of my directories(OS agnostic). - new structure should be all lower-case with hyphphens for spaces - Using windows, I am running the following: Dir.foreach("./"){ |d| next if d =~ /[a-z]+\.[a-z]+/ next if d == "." or d == ".." d.downcase! newfile = d.gsub(/\W/, "-") File.rename(d, newfile) } so I want: \Test Dir1 \TestDir2\TestDir 1 to change to \test-dir1 \testdir2\testdir-1 Which works fine on the top level, but is not recursing down to the next level. Filenames should be ignored. I've tried playing with various methods on the Dir class (entries, etc..). Using Dir[**/**] is throwing up saying that it can't rename (no surprise since it can't rename without an absolute path, I guess). Please help thanks! -- Posted via http://www.ruby-forum.com/.