#!/bin/sh
find ./ -name "*" -o -name ".*" 2>/dev/null |sed -e 's/^/.//' |sed -n '2,$p' | while read line
do
a=`echo $line |awk -F// '{print NF}'`
a=$((a-2))
i=1
case $a in
0) echo $line |sed -e 's|---/' ;;
*) while [ ! $i -gt $a ]; do
line=`echo $line |sed -e 's///[^//]*/| /'`
i=$((i+1))
done
echo $line |sed -e 's|---/' -e 's/ */ /g';;
esac
done
#! /bin/sh
case $# in
0) curpath=$PWD ;;
1) cd $1 2>/dev/null && curpath=$PWD || exit 9 ;;
*) echo "usage $0 [path]" ; exit 1 ;;
esac
case $(uname) in
HP-UX) ECHO="echo " ;;
*) ECHO="echo -e " ;;
esac
echo $curpath
pre=$(echo $curpath |awk -F/ '{print NF}')
find $curpath -name "*" -o -name ".*" 2>/dev/null |sed -n '2,$p' |while read line; do
i=2
num=$(echo $line |awk -F/ '{print NF}')
num=$((num-pre+1))
while [ $i -lt $num ] ; do
$ECHO "| /c"
num=$((num-1))
done
$ECHO "|-----"${line##*/}
done