Web lists-archives.com

Re: RFE: find <path> -d -size 0 => doesn't find empty directories

On 10/31/2018 7:02 PM, L A Walsh wrote:
Something I can use on my /tmp files on linux is a find command:

find /tmp -size 0 -delete

to delete zero-len-files or empty-directories in /tmp.

What flavor of Linux are you using where this works for you? I'm running Ubuntu 16.04 at the moment, and I just tried the following in an otherwise empty directory:

   $ mkdir b
   $ find . -size 0

The directory 'b' did not show up, hence was not reporting as size 0. The man page for -size does not mention any special behavior for directories as opposed to regular files, so I would expect Linux to never report any directory as size 0, since they always have '.' and '..' entries, as you suggested.

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple