From: Nobuyoshi Nakada Date: 2006-10-14T10:55:03+09:00 Subject: Re: Newbie - File Rename Hi, At Sat, 14 Oct 2006 06:10:23 +0900, Snoopy Dog wrote in [ruby-talk:219613]: > if File.file? path > puts path + ' is a file' > oldname = path newname = path.sub('longfilename - 0', '0') > puts newname + ' Is the newfile' > puts "\n\nCheck About to RENAME file" > File.rename(oldname, newname) > puts 'Renamed ' + oldname + ' to ' + newname + "\n\n\n" > end Assigning path to newpath doesn't create a new string, but makes the latter to share the same string with the former and oldname. -- Nobu Nakada