您可以计算/路径:
$ find . -type f -exec bash -c 'echo '{}' | grep -o / | wc -l' \;
Run Code Online (Sandbox Code Playgroud)
或者使用文件名:
$ mkdir -p one/two/three four/five && touch file one/two/file one/two/three/file
$ find . -type f -exec bash -c 'echo -n '{}' :; echo '{}' | grep -o / | wc -l' \;
./file :1
./one/two/file :3
./one/two/three/file :4
Run Code Online (Sandbox Code Playgroud)