DEV Community

Query Filter
Query Filter

Posted on

ftree

ftree() {
# robust-ish (no -z); safe in most normal cases
while IFS= read -r dir; do
printf '%s\n' "$dir"
find "$dir" -maxdepth 1 -type f | sort
done < <(find "${1:-.}" -type d | sort) | sed -e 's;[^/]*/;|_;g;s;_|; |;g'
}

Top comments (0)