Thanks for that Marvin
I tried it and we have spaces in out folder names so amended the script with double quotes around the source path:
import sys
import os
import string
from xattr import xattr
if (len(sys.argv)<3):
print "usage: dircopy dir1 dir2"
sys.exit()
fread = os.popen('find "%s" -type d -print' %sys.argv[1])
folders = fread.read()
fread.close()
fnames = string.split(folders,"\n")
for f in fnames:
strip = len(sys.argv[1])
if(len(f)==0): continue
attrs = xattr(f)
key = u'com.apple.FinderInfo'
findervals = attrs.copy().get(key, chr(0)*32)
f = '%s%s' %(sys.argv[2],f[strip:])
os.popen('mkdir -p "%s"' %f)
attrs = xattr(f)
attrs.set(key, findervals)