Find and delete all files without extensions witin a folder and its subfolders
I have a folder without around 500 subdirectories. There is a lot of trash to be found in it and I want to clean it up.
I have already deleted certain filetypes that I don't want, like images, with this command:
find . -mindepth 1 -iname "*.jpg" -type f -delete
However, I now want to delete all extension-less files. Files like "Shopping list" intead of "Shopping list.txt"
I have tried the following command but it did not work:
find . -mindepth 1 ! -iname "*.*" -type f -delete
Try this:
find . -type f ! -name "*.*" -delete
However, note that the above will not delete files whose name ends in a .
, for example foo.
. To delete those as well, use this instead:
find . -type f ! -name "*.?*" -delete
You could use:
find . -type f ! -name "*.*" -delete