curPath = Dir.pwd
Dir.foreach(curPath) do |f|
if f=~/gun.*\.bmp/ #modif the pattern to your own
File.rename(f,f.split.join('').to_s) #replace the spaces
end
end
把源文件"gun (123).bmp"改成"gun(123).bmp",去掉文件名中的空格
curPath = Dir.pwd
Dir.foreach(curPath) do |f|
if f=~/gun.*\.bmp/ #modif the pattern to your own
File.rename(f,f.split.join('').to_s) #replace the spaces
end
end
把源文件"gun (123).bmp"改成"gun(123).bmp",去掉文件名中的空格