Sorry to get off subject, but this would work for me. Only problem is when there is a space in the filename.technosaurus wrote:just save this into a script to test the dir_tree portionCode: Select all
#!/bin/sh DIR=$1 [ $2 ] && SPACING=$2 || SPACING="|" for x in `ls $DIR`; do [ -d $DIR/$x ] && echo "$SPACING\`-{"$x && $0 $DIR/$x "$SPACING " done
'for' splits the input by line, and any file name with a space in it throws it off.
Normally I would use double quotes around a variable to prevent this, but with the for/next loop I am not sure.