Unix Linux find and delete empty folders and files
Finding and deleting empty folders and files with Unix is a task in the cleanup of project directories. These are basically not even recorded in Git, but anyway they lead to confusion and are also unnecessary. Here a Linux command is necessary, which can be used recursively. With the following commands one can find and also remove empty directories and files in Linux file structures. For this work it is of course advisable to have a fullbackup of the system. It is also possible that applications insist on certain folders or files, even if they are simply empty.
Unix Linux find empty folder in current directory
find . -type d -empty
Unix Linux find empty directories in current directory and remove them automatically
find . -type d -empty -exec rmdir {} \;
Unix Linux find empty files in current directory
find . -type f -empty
Unix Linux Number of empty files in current directories and subdirectories
find . -type f -empty | wc -l
Unix Linux How many non-empty files are in the current directory and its subdirectories
find . -type f -not -empty | wc -l