B
Boris \BXS\ Schulz
Hi,
somehow File.rename does not work in the little script i pasted below,
can someone help me out there ? I am using Windows XP Prof, and Ruby 180-10
#################################################################
regex = Regexp.new('\((1|2|3|4|5|6|7|8|9)\)')
Dir::foreach(Dir.getwd){ |filename|
n = regex=~filename
if n
newname = filename.sub(regex, "(0#{filename[n+1].chr})")
f = File.open(filename, "wb+")
f.rename(filename, newname)
f.close()
end
}
#################################################################
the error i get is this:
undefined method `rename' for #<File:Until Further Notice (1) Wooden
Man.mp3><NoMethodError>
from 1-to-01.rb:2:in 'foreach'
from 1-to-01.rb:2
greetings, BXS
somehow File.rename does not work in the little script i pasted below,
can someone help me out there ? I am using Windows XP Prof, and Ruby 180-10
#################################################################
regex = Regexp.new('\((1|2|3|4|5|6|7|8|9)\)')
Dir::foreach(Dir.getwd){ |filename|
n = regex=~filename
if n
newname = filename.sub(regex, "(0#{filename[n+1].chr})")
f = File.open(filename, "wb+")
f.rename(filename, newname)
f.close()
end
}
#################################################################
the error i get is this:
undefined method `rename' for #<File:Until Further Notice (1) Wooden
Man.mp3><NoMethodError>
from 1-to-01.rb:2:in 'foreach'
from 1-to-01.rb:2
greetings, BXS