From: William James Date: 2006-02-17T12:28:29+09:00 Subject: Re: Ruby script to Module/Class refactor James B. Byrne wrote: > # find, move and optionally rename data files that match glob expression > # provided. > # > # ruby mv2dir.rb source_dir glob_exp [target_dir=./] [ext] # ruby mv2dir.rb source_dir glob_exp target_dir require 'fileutils' Dir[ File.join(ARGV[0], "*") ].select{ |p| Regexp.new(ARGV[1]).match File.basename( p ) }.each{ |p| FileUtils.move( p, ARGV[2] ) }