From: Andrea Fazzi Date: 2007-09-27T03:04:18+09:00 Subject: Re: Recursing through directories Gabriel Dragffy ha scritto: > > On 26 Sep 2007, at 16:33, Sebastian Hungerecker wrote: > >> Gabriel Dragffy wrote: >>> require 'ftools' >>> Dir.entries( '/Volumes/' ).each |item| do >>> File.move( item, item.gsub( /\//, '-' ) ) if File.file? item >>> end >>> >>> The idea is to remove slashes from file names, I can later extend >>> this to include other characters also. But how the deuce can I make >>> it go in to each directoy to make sure each file is renamed even many >>> subdirectories down? >> >> Use Dir['/Volumes/**/*'] (or even *-* to only get files with a slash >> in them) >> instead of Dir.entries. >> > > Will this operate recursively? > > Many thanks > > Gabriel > > > > Yes. Dir['/Volumes/**/*'] will match the directories recursively. Bye. Andrea