How to find all file extensions recursively from a

2020-02-16 07:44发布

What command, or collection of commands, can I use to return all file extensions in a directory (including sub-directories)?

Right now, I'm using different combinations of ls and grep, but I can't find any scalable solution.

8条回答
一夜七次
2楼-- · 2020-02-16 08:02
find . -type f | sed 's|.*\.||' | sort -u

Also works on mac.

查看更多
Deceive 欺骗
3楼-- · 2020-02-16 08:12
ls -1 | sed 's/.*\.//' | sort -u

Update: You are correct Matthew. Based on your comment, here is an updated version:

ls -R1 | egrep -C 0 "[^\.]+\.[^\./:]+$" | sed 's/.*\.//' | sort -u

查看更多
登录 后发表回答