summaryrefslogtreecommitdiff
path: root/jni/ruby/ext/win32ole/sample/oledirs.rb
blob: dbacc2131d3dd8cbf37e4c09d1040b9cb8f0102e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
# You need WSH(Windows Scripting Host) to run this script.
#

require "win32ole"

def listup(items)
#  items.each do |i|
  for i in items
    puts i.name
  end
end

fs = WIN32OLE.new("Scripting.FileSystemObject")

folder = fs.GetFolder(".")

puts "--- folder of #{folder.path} ---"
listup(folder.SubFolders)

puts "--- files of #{folder.path} ---"
listup(folder.Files)