How can I make the find command show a slash after directories? For example, I want dir
to show up as dir/
instead of dir
. I'm using find . -print
Find Command – Make Find Show Slash After Directories
find
find
How can I make the find command show a slash after directories? For example, I want dir
to show up as dir/
instead of dir
. I'm using find . -print
Best Answer
Portably:
If you're willing to list directories and files separately (you can merge the output by sorting):
With GNU find, see Shawn J. Goff's answer.
If you're willing to risk non-printable characters being mangled even when not outputting to a terminal, see ddeimeke's answer.
In zsh:
print -rl -- **/*(DM)
(D
to include dot files,M
to add a/
after directories)