1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#!/bin/sh set -e set -u usage() { echo "$0 [directory]" exit 1 } if [ $# = 1 ]; then cd "$1" || usage elif [ $# != 0 ]; then usage fi gfind * -type d -printf 'dir path=%p\n' gfind * -type f -printf "file $1/%p path=%p\n" gfind * -type l -printf 'link path=%p target=%l\n' exit 0