[wellylug] Empty Directories

michael at diaspora.gen.nz michael at diaspora.gen.nz
Tue Apr 4 16:16:11 NZST 2006


"Ian Beardslee" writes:
>Hi geniuses ... and anyone else who may be able to answer ...
>How can I go about finding all directories in a filesystem that are empty?

To my astonishment, as I've never used this feature of find before, and
didn't know about it before researching this, this is quite easy to do:

    find <filesystem> -type d -empty

Will produce a list of all empty directories.

    find <filesystem> -type f -empty

Will produce a list of all empty files.

Obviously, substitute a path for <filesystem>; eg /var, or /home, or /.
    -- michael.




More information about the wellylug mailing list