你的采纳是我前进的动力,还有不懂的地方,请继续“追问”。
如你还有别的问题,可另外向我求助;答题不易,互相理解,互相帮助。
如果不需要递归删除文件夹里子文件夹的内容,下面这个就可以了。 directory = "D:\\data" Dir.foreach(directory) do |item| if item != '.' and item != '..' u_dir = directory + File::Separator + item if File.require "win32ole"cd = WIN32OLE.new("MSComDlg.CommonDialog")
cd.filter = "All Files(*.*)|*.*" +"|Ruby Files(*.rb)|*.rb"
cd.filterIndex = 2
cd.maxFileSize = 128# Set MaxFileSize
cd.showOpen()
file = cd.fileName # Retrieve file, path
if not file or file==""
puts "No filename entered."
else
puts "The user selected: #{file}\n"
end