File 使用Dir.glob从目录中收集文件,现在我想将它们全部移动到一个文件夹中。怎么用?
现在我想将它们移动到桌面上一个名为“target_folder”的文件夹中,我该怎么做 我尝试了这个方法,但它返回了“未定义的局部变量或main:Object(namererror)的方法`fileutils'” 这是我学习Ruby第三周的开始,也是我的第一个项目。如果这个问题看起来很简单,我很抱歉。再次感谢。试试这个:File 使用Dir.glob从目录中收集文件,现在我想将它们全部移动到一个文件夹中。怎么用?,file,move,glob,File,Move,Glob,现在我想将它们移动到桌面上一个名为“target_folder”的文件夹中,我该怎么做 我尝试了这个方法,但它返回了“未定义的局部变量或main:Object(namererror)的方法`fileutils'” 这是我学习Ruby第三周的开始,也是我的第一个项目。如果这个问题看起来很简单,我很抱歉。再次感谢。试试这个: require 'fileutils' docx_files.each do |x| fileutils.mv Dir( 'x', '/Users
require 'fileutils'
docx_files.each do |x|
fileutils.mv Dir( 'x', '/Users/desktop/jorgeolivero/target_folder' )
end
require 'fileutils'
docx_files.each do |x|
fileutils.mv Dir( 'x', '/Users/desktop/jorgeolivero/target_folder' )
end
require 'fileutils'
docx_files.each do |x|
FileUtils.mv x, "/Users/desktop/jorgeolivero/target_folder"
end