summaryrefslogtreecommitdiffstats
path: root/Demo/pdist/sumtree.py
blob: 92e7771cbfa0ded174a3f3736b66665ffb29bd3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import time
import sys
import FSProxy

def main():
    t1 = time.time()
    #proxy = FSProxy.FSProxyClient(('voorn.cwi.nl', 4127))
    proxy = FSProxy.FSProxyLocal()
    sumtree(proxy)
    proxy._close()
    t2 = time.time()
    print(t2-t1, "seconds")
    sys.stdout.write("[Return to exit] ")
    sys.stdout.flush()
    sys.stdin.readline()

def sumtree(proxy):
    print("PWD =", proxy.pwd())
    files = proxy.listfiles()
    proxy.infolist(files)
    subdirs = proxy.listsubdirs()
    for name in subdirs:
        proxy.cd(name)
        sumtree(proxy)
        proxy.back()

main()