From: Chris Kottom Date: 2009-03-16T20:59:42+09:00 Subject: Re: rudamentary question --0016e6ddab323a2a6d04653aeb1a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit You should be able to make something out of: - Dir#glob (http://www.ruby-doc.org/core/classes/Dir.html#M002347) - String#sub (http://www.ruby-doc.org/core/classes/String.html#M000831) - String#gsub (http://www.ruby-doc.org/core/classes/String.html#M000832) The code is left as an exercise for the reader. :) On Mon, Mar 16, 2009 at 12:21 PM, Hayden Smith wrote: > Greetings, > I'm looking to write a script to perform the functions listed as below, > would anyone have any ideas as to how I might approach this situation: > 1. I have a file called "David Slater - Pensive Moments.txt" which I wish > to format to look like "David_Slater_-_Pensive_Moments.txt": Therefore > translating all spaces for underscores. > 2. I have a file called "[01] I am a fish.mp3" which I want to look like > "01-I_Am_A_Fish.mp3" thus removing open brackets around numbers at the > beginning, replacing the space between the number and name with a dash and > performing the listed function as above. > 3. The listed functions are required to be performed recursively across > directory trees. > Any assistance people can provide would be most appreciated. > Regards, > Hayden Smith > ---------- > Hayden Smith > Email - tardis.tardis@gmail.com > website - http://www.AlternateProjects.com > Blog - http://SolaceOfTheMind.BlogSpot.com > Phone-- > Australia: > Gold Coast - +617-56-678-016 > Melbourne - +613-86-836-894 > Sydney - +612-80-617-305 > United States: > +1-310-405-6408 (with extension 61756678016) > United Kingdom: > +44-292-000-7380 (with extension 61756678016) --0016e6ddab323a2a6d04653aeb1a--