How can I make this program smaller?
There is a bug with your minified version: s[:-0] gives you the empty string, not the complete string as you anticipate with s[:-i==len(a)-1]. To rectify this, you will need to either ignore preceding bars or calculate the a little more thoroughly. The shorter version would be to ignore preceding bars and not worry about passing spacing to further recursions. Since it permits the removal of several variables, I worked your code to do this

Your tree function is only called once, I removed it.

s=s+'|' and i=i+1 can be collapsed into s+='|' and i+=1

os.path as p can become p=os.path (Thanks James)

p.join(c,f) can become c+'/'+f (Thanks beary605)

New version: 

import os,p=os.path
def w(c,d):
    for f in os.listdir(c):
        print '  '*(d+1)+'|--'+f;j=c+'/'+f
        if p.isdir(j): w(j,d+1)
z=p.curdir;print z;w(p.curdir,0)


If you really wanted to go crazy, you can make put this all on one line and get it down to 143 bytes (on linux)

import os,p=os.path
def w(c,d):
 for f in os.listdir(c):print'  '*(d+1)+'|--'+f;j=c+'/'+f;w(j,d+1)if p.isdir(j)else 0
z=p.curdir;print z;w(z,0)