📅  最后修改于: 2022-03-11 15:04:47.455000             🧑  作者: Mango
my_dir = Dir["C:/Documents and Settings/user/Desktop/originalfiles/*.doc"]
my_dir.each do |filename|
name = File.basename('filename', '.doc')[0,4]
dest_folder = "C:/Documents and Settings/user/Desktop/destinationfolder/#{name}/"
FileUtils.cp(filename, dest_folder)
end