public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Mark Geisert <mark@maxrnd.com>
To: cygwin@cygwin.com
Subject: Re: RFE: find <path> -d -size 0 => doesn't find empty directories
Date: Thu, 01 Nov 2018 04:40:00 -0000	[thread overview]
Message-ID: <9c0c7f6c-f400-59f2-1002-c81aeffba96f@maxrnd.com> (raw)
In-Reply-To: <a0f243ea-c208-1ad2-84c2-3f2d1815cc99@maxrnd.com>

Correcting my earlier post...

Mark Geisert wrote:
> 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.
>>
>> 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.
>>
>> 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?
>
> Try 'find -d -empty'

I shouldn't have blindly trusted the Subject:.  My point was to use find's 
'-empty' option to identify empty objects.  So...
     find . -type d -empty     to find empty directories under '.'
     find . -type f -empty     to find empty files under '.'
     find . -empty             to find empty directories or files under '.'

None of this is Cygwin-specific, by the way.  'man find' was my friend.
Cheers,

..mark


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

  reply	other threads:[~2018-11-01  4:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-31 23:02 L A Walsh
2018-11-01  0:02 ` Norton Allen
2018-11-01  1:16 ` Mark Geisert
2018-11-01  4:40   ` Mark Geisert [this message]
2018-11-01 16:27     ` (SOLVED) " L A Walsh
2018-11-02  5:33       ` Mark Geisert
2018-11-01 16:20 ` Andrey Repin
2018-11-02  5:05   ` Brian Inglis
2018-11-02 14:05     ` Andrey Repin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9c0c7f6c-f400-59f2-1002-c81aeffba96f@maxrnd.com \
    --to=mark@maxrnd.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).