From: Jason Roelofs Date: 2008-04-25T23:38:33+09:00 Subject: Re: Find.prune if ( filename[-5,5] != ".java") is odd? On Fri, Apr 25, 2008 at 8:28 AM, Martin Elzen wrote: > > Hi all. > > Today I had to do a recursive touch on all Java files in a certain directory. Since I recently found that super cool ruby Find example I figured I'd use that. However, my first try at a solution didn't work. In the end I just changed the script a bit and now it does work as intended, but... I really don't understand why the first version of the example didn't work... It's the Ruby 1.8.6 1-click-installer version, if that matters. > > > require "find" > > > Find.find( "c:/usd70.senior.2008.04.14.copy" ) do |filename| > Find.prune if filename == "." > Find.prune if (filename.size < 6) # shortest interesting filename == "a.java" > > # first try, if I don't comment-out the following line it just does not work as intended... > #Find.prune if ( filename[-5,5] != ".java") # string doesn't end with ".java" ? > #`touch #{filename}` > > > `touch #{filename}` if filename[-5,5] == ".java" > > end > > What about: Dir["c:/usd70.senior.2008.04.14.copy/**/*.java"].each { |f| `touch #{f}` } Jason