X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=vuu+BNhNieSnw3oD b+XO5VHeOftxBUByuE4cHD58DkC7RE6kseRCVep4L2oPj6FQDM8l1s9emsuN2uon 8CqQKEOiUBoFtr4P7uQgCxRrkUSkxCo4ba70AJ3E3vn9lZpNZ3Kg3boy5tb1m6+I uhVXlhp8QxRycgNzLZi7XtA+9BY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=+WbNb83XF4MgnJ2aed1udS 51Jko=; b=pDr0NonHfI0qYCNteYsk+JHr2GT0GSkNWV12VhFIU12TR6w/7q/y4g wgTzJnNiLT1zbptxZzhojohO+a4jUYxWU8u2V1dEUV93Ufoso5xHkSlazouCS2og +9GFTU2PqHSkvxiPPFUUjPKr0VnHaX+stK7Dr7UtKCexkSlY8fFHo= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=Geisert, Hx-languages-length:1311, H*F:U*mark, geisert X-HELO: m0.truegem.net Subject: Re: RFE: find -d -size 0 => doesn't find empty directories To: cygwin AT cygwin DOT com References: <5BDA347D DOT 8070909 AT tlinx DOT org> From: Mark Geisert Message-ID: <9c0c7f6c-f400-59f2-1002-c81aeffba96f@maxrnd.com> Date: Wed, 31 Oct 2018 21:39:50 -0700 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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