Friday, March 26, 2021

finding and listing files without extensions in Linux

This post - 
https://askubuntu.com/questions/337964/list-all-files-that-do-not-have-extensions
uses ls to list all files without extensions.

Then there is the technique using find,
https://unix.stackexchange.com/questions/47151/how-do-i-list-every-file-in-a-directory-except-those-with-specified-extensions
to list those files other than those with specific extensions, which I used like

find nameofdirectory ! '(' -name '*.mp3' -o -name '*.docx' -o -name '*.zip' ')'

find nameofdirectory ! '(' -name '*.*'  ')'
lists directories also.

find nameofdirectory -type f ! '(' -name '*.*' ')' | wc -l 
for counting the total.

No comments:

Post a Comment