2 # **********************************************************************
4 # Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
6 # This copy of Ice is licensed to you under the terms described in the
7 # ICE_LICENSE file included in this distribution.
9 # **********************************************************************
12 Ice::loadSlice('Filesystem.ice')
14 # Recursively print the contents of directory "dir"
15 # in tree fashion. For files, show the contents of
16 # each file. The "depth" parameter is the current
17 # nesting level (for indentation).
19 def listRecursive(dir, depth)
29 subdir = Filesystem::DirectoryPrx::checkedCast(node)
30 file = Filesystem::FilePrx::uncheckedCast(node)
31 print indent + node.name()
34 listRecursive(subdir, depth)
39 puts indent + "\t" + line
48 # Create a communicator
50 ic = Ice::initialize(ARGV)
52 # Create a proxy for the root directory
54 obj = ic.stringToProxy("RootDir:default -p 10000")
56 # Down-cast the proxy to a Directory proxy
58 rootDir = Filesystem::DirectoryPrx::checkedCast(obj)
60 # Recursively list the contents of the root directory
62 puts "Contents of root directory:"
63 listRecursive(rootDir, 0)
66 print ex.backtrace.join("\n")
77 print ex.backtrace.join("\n")