ext/win32ole/sample/oledirs.rb


DEFINITIONS

This source file includes following functions.


   1  #
   2  # You need WSH(Windows Scripting Host) to run this script.
   3  #
   4  
   5  require "win32ole"
   6  
   7  def listup(items)
   8  #  items.each do |i|
   9    for i in items
  10      puts i.name 
  11    end
  12  end
  13  
  14  fs = WIN32OLE.new("Scripting.FileSystemObject")
  15  
  16  folder = fs.GetFolder(".")
  17  
  18  puts "--- folder of #{folder.path} ---"
  19  listup(folder.SubFolders)
  20  
  21  puts "--- files of #{folder.path} ---"
  22  listup(folder.Files)
  23