Listing all empty folders on your Linux system can be very useful, this is how to do this easily. The command below will easily perform this task.
(base) jason@jason-Lenovo-H50-55:~$ sudo find / -type d -empty | sort -u |
And how to count all of these unused empty folders.
(base) jason@jason-Lenovo-H50-55:~$ sudo find / -type d -empty | sort -u | wc -l find: ‘/run/user/1000/gvfs’: Permission denied 5585 |
This could be a very useful Linux tip indeed.
Convert the output into a csv file.
(base) jason@jason-Lenovo-H50-55:~$ sudo find / -type d -empty | tr '\n' , > directories.csv find: ‘/run/user/1000/gvfs’: Permission denied
This is how to find directories that contain no other directories, but may or may not contain regular files.
(base) jason@jason-Lenovo-H50-55:/$ sudo find . -type d | sort -r | awk 'index(a,$0)!=1{a=$0;print}' | sort |