This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Greetings, L A Walsh!

> Something I can use on my /tmp files on linux is a find command:

> find /tmp -size 0 -delete

Do note that -size on directories is filesystem dependent.
I.e. on ext2+ it's the number of bytes allocated to directory structure, in
multiplies of whole blocks.

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

> Unfortunately, due to directories really not being in the user
> disk data space, but in the MFT(zone) (I think), the size
> comes back as zero ('0') for directories.

Just as predicted.
If you want to find files, search for files.

find . -type f ...

> Would it be possible (if not problematic) for the cygwin
> emulation layer to return some non-zero value if the
> directory has actual entries in it (ignoring structural
> values like "." and "..")?  Maybe return as 'size' either
> a dummy number proportional to #entries (like 10*#entries),
> or something like summing up actual number (+1) of characters
> in the file list?

> Would that be difficult to do, or add?

Having something to this extent would be useful in case of searching for
directories with too many files, for example.

I'd vote for something like (entries << 7), which is closer to an average ext2
counter. No need to ignore anything.


-- 
With best regards,
Andrey Repin
Thursday, November 1, 2018 19:00:26

Sorry for my terrible english...


--
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]