[an error occurred while processing this directive]
[an error occurred while processing this directive]
Find.find("パス名") do |f|
print f
end
fには"パス名"で指定したところからの相対パスが入ります。
下みたいにディレクトリを開く場合は、fにはファイル名しか入らないので、ちょっと挙動が違います。
Dir.open("パス名").each do |f|
print f
end
ret = File.join("/tmp", "hello")
ret には /tmp/hello が入る。
updated_files = ["capsule__BITRATE_10E2__.mpg", "capsule__BITRATE_10E3__.mpg", "capsule__BITRATE_10E4__.mpg", "hoge"]
ptn = /.+__BITRATE_\d+E\d+__\.mpg/
updated_files.each { |f|
if f =~ ptn then
print "#{f} is matched against ptn\n"
else
print "#{f} is not matched against ptn\n"
end
}
File.size("hoge.txt")