#!/bin/rc # # script for cloning a directory tree but no files # primary application : binding empty directories on /sys/src # Example : # grow_tree /sys/src /tmp/tree # bind -ac /tmp/tree /sys/src fn get_dirs { tmp = /tmp/$pid ^_dirs echo -n > $tmp for (f in `{du -nf $root_in | awk '{print $2}' }) ls -l $f | grep '^d' | awk '{print $10}' >> $tmp dirs = `{sort $tmp} rm $tmp } root_in=$1 root_out=$2 if(~ $3 '') get_dirs; if not dirs = `{cat $3}; mkdir $root_out mkdir `{ echo $dirs | awk ' { gsub(ENVIRON["root_in"], ENVIRON["root_out"], $0); print } ' } # bind -bc $root_out $root_in # grow_tree /n/sauce/sys/src /usr/matt/kill0r /usr/matt/sys.src # /n/sauce/sys/src/fs/killme # /usr/matt/kill0r # ls /n/sauce/sys/src/9/bitsy/*101