I have done a lot of cleanup by removing files in a directory tree. I would now like to delete the empty directories as there are now a lot of ‘almost empty’ directories: they contain only a hidden .directory file. So doing find -empty comes up… empty. I don’t want to delete the dot-files of the directories that contain other files.
I can think of some complex bash script threaded through find but I can’t think of a simple way to do it… For instance the solution here (Linux: delete all directories with only one file and no subdirectories) does not find dot files.
Clarification: A .directory is a hidden text file created by KDE (dolphin ?) and contains information pertaining to how to display the content of the directory, for instance thumbnails, or list of files, or just their icons, etc… When the files are deleted, the .directory file remains but is now mostly useless.